1&&"string"==typeof f&&!v.checkClone&&Ie.test(f))return e.each(function(r){var o=e.eq(r);g&&(n[0]=f.call(this,r,o.html())),Ve(o,n,t,l)});if(p&&(o=(r=Ce(n,e[0].ownerDocument,!1,e,l)).firstChild,1===r.childNodes.length&&(r=o),o||l)){for(u=(i=x.map(be(r,"script"),Oe)).length;d0&&_e(i,!d&&be(e,"script")),c},cleanData:function(e){for(var n,t,l,r=x.event.special,o=0;void 0!==(t=e[o]);o++)if(Z(t)){if(n=t[X.expando]){if(n.events)for(l in n.events)r[l]?x.event.remove(t,l):x.removeEvent(t,l,n.handle);t[X.expando]=void 0}t[Y.expando]&&(t[Y.expando]=void 0)}}}),x.fn.extend({detach:function(e){return je(this,e,!0)},remove:function(e){return je(this,e)},text:function(e){return z(this,function(e){return void 0===e?x.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Ve(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Me(this,e).appendChild(e)})},prepend:function(){return Ve(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var n=Me(this,e);n.insertBefore(e,n.firstChild)}})},before:function(){return Ve(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Ve(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,n=0;null!=(e=this[n]);n++)1===e.nodeType&&(x.cleanData(be(e,!1)),e.textContent="");return this},clone:function(e,n){return e=null!=e&&e,n=null==n?e:n,this.map(function(){return x.clone(this,e,n)})},html:function(e){return z(this,function(e){var n=this[0]||{},t=0,l=this.length;if(void 0===e&&1===n.nodeType)return n.innerHTML;if("string"==typeof e&&!De.test(e)&&!me[(ve.exec(e)||["",""])[1].toLowerCase()]){e=x.htmlPrefilter(e);try{for(;t=0&&(s+=Math.max(0,Math.ceil(e["offset"+n[0].toUpperCase()+n.slice(1)]-o-s-u-.5))||0),s}function en(e,n,t){var l=Fe(e),r=(!v.boxSizingReliable()||t)&&"border-box"===x.css(e,"boxSizing",!1,l),o=r,i=Ue(e,n,l),u="offset"+n[0].toUpperCase()+n.slice(1);if(Le.test(i)){if(!t)return i;i="auto"}return(!v.boxSizingReliable()&&r||!v.reliableTrDimensions()&&D(e,"tr")||"auto"===i||!parseFloat(i)&&"inline"===x.css(e,"display",!1,l))&&e.getClientRects().length&&(r="border-box"===x.css(e,"boxSizing",!1,l),(o=u in e)&&(i=e[u])),(i=parseFloat(i)||0)+Ke(e,n,t||(r?"border":"content"),o,l,i)+"px"}function nn(e,n,t,l,r){return new nn.prototype.init(e,n,t,l,r)}x.extend({cssHooks:{opacity:{get:function(e,n){if(n){var t=Ue(e,"opacity");return""===t?"1":t}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,n,t,l){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var r,o,i,u=G(n),s=Ze.test(n),a=e.style;if(s||(n=We(u)),i=x.cssHooks[n]||x.cssHooks[u],void 0===t)return i&&"get"in i&&void 0!==(r=i.get(e,!1,l))?r:a[n];"string"==(o=typeof t)&&(r=le.exec(t))&&r[1]&&(t=ae(e,n,r),o="number"),null!=t&&t==t&&("number"!==o||s||(t+=r&&r[3]||(x.cssNumber[u]?"":"px")),v.clearCloneStyle||""!==t||0!==n.indexOf("background")||(a[n]="inherit"),i&&"set"in i&&void 0===(t=i.set(e,t,l))||(s?a.setProperty(n,t):a[n]=t))}},css:function(e,n,t,l){var r,o,i,u=G(n);return Ze.test(n)||(n=We(u)),(i=x.cssHooks[n]||x.cssHooks[u])&&"get"in i&&(r=i.get(e,!0,t)),void 0===r&&(r=Ue(e,n,l)),"normal"===r&&n in Xe&&(r=Xe[n]),""===t||t?(o=parseFloat(r),!0===t||isFinite(o)?o||0:r):r}}),x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,t,l){if(t)return!Ge.test(x.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?en(e,n,l):He(e,Qe,function(){return en(e,n,l)})},set:function(e,t,l){var r,o=Fe(e),i=!v.scrollboxSize()&&"absolute"===o.position,u=(i||l)&&"border-box"===x.css(e,"boxSizing",!1,o),s=l?Ke(e,n,l,u,o):0;return u&&i&&(s-=Math.ceil(e["offset"+n[0].toUpperCase()+n.slice(1)]-parseFloat(o[n])-Ke(e,n,"border",!1,o)-.5)),s&&(r=le.exec(t))&&"px"!==(r[3]||"px")&&(e.style[n]=t,t=x.css(e,n)),Ye(0,t,s)}}}),x.cssHooks.marginLeft=qe(v.reliableMarginLeft,function(e,n){if(n)return(parseFloat(Ue(e,"marginLeft"))||e.getBoundingClientRect().left-He(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),x.each({margin:"",padding:"",border:"Width"},function(e,n){x.cssHooks[e+n]={expand:function(t){for(var l=0,r={},o="string"==typeof t?t.split(" "):[t];l<4;l++)r[e+re[l]+n]=o[l]||o[l-2]||o[0];return r}},"margin"!==e&&(x.cssHooks[e+n].set=Ye)}),x.fn.extend({css:function(e,n){return z(this,function(e,n,t){var l,r,o={},i=0;if(Array.isArray(n)){for(l=Fe(e),r=n.length;i1)}}),x.Tween=nn,(nn.prototype={constructor:nn,init:function(e,n,t,l,r,o){this.elem=e,this.prop=t,this.easing=r||x.easing._default,this.options=n,this.start=this.now=this.cur(),this.end=l,this.unit=o||(x.cssNumber[t]?"":"px")},cur:function(){var e=nn.propHooks[this.prop];return e&&e.get?e.get(this):nn.propHooks._default.get(this)},run:function(e){var n,t=nn.propHooks[this.prop];return this.pos=n=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*n+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),t&&t.set?t.set(this):nn.propHooks._default.set(this),this}}).init.prototype=nn.prototype,(nn.propHooks={_default:{get:function(e){var n;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(n=x.css(e.elem,e.prop,""))&&"auto"!==n?n:0},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):1!==e.elem.nodeType||!x.cssHooks[e.prop]&&null==e.elem.style[We(e.prop)]?e.elem[e.prop]=e.now:x.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=nn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},x.fx=nn.prototype.init,x.fx.step={};var tn,ln,rn=/^(?:toggle|show|hide)$/,on=/queueHooks$/;function un(){ln&&(!1===b.hidden&&t.requestAnimationFrame?t.requestAnimationFrame(un):t.setTimeout(un,x.fx.interval),x.fx.tick())}function sn(){return t.setTimeout(function(){tn=void 0}),tn=Date.now()}function an(e,n){var t,l=0,r={height:e};for(n=n?1:0;l<4;l+=2-n)r["margin"+(t=re[l])]=r["padding"+t]=e;return n&&(r.opacity=r.width=e),r}function cn(e,n,t){for(var l,r=(dn.tweeners[n]||[]).concat(dn.tweeners["*"]),o=0,i=r.length;o1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})}}),x.extend({attr:function(e,n,t){var l,r,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===e.getAttribute?x.prop(e,n,t):(1===o&&x.isXMLDoc(e)||(r=x.attrHooks[n.toLowerCase()]||(x.expr.match.bool.test(n)?pn:void 0)),void 0!==t?null===t?void x.removeAttr(e,n):r&&"set"in r&&void 0!==(l=r.set(e,t,n))?l:(e.setAttribute(n,t+""),t):r&&"get"in r&&null!==(l=r.get(e,n))?l:null==(l=x.find.attr(e,n))?void 0:l)},attrHooks:{type:{set:function(e,n){if(!v.radioValue&&"radio"===n&&D(e,"input")){var t=e.value;return e.setAttribute("type",n),t&&(e.value=t),n}}}},removeAttr:function(e,n){var t,l=0,r=n&&n.match(j);if(r&&1===e.nodeType)for(;t=r[l++];)e.removeAttribute(t)}}),pn={set:function(e,n,t){return!1===n?x.removeAttr(e,t):e.setAttribute(t,t),t}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var t=hn[n]||x.find.attr;hn[n]=function(e,n,l){var r,o,i=n.toLowerCase();return l||(o=hn[i],hn[i]=r,r=null!=t(e,n,l)?i:null,hn[i]=o),r}});var fn=/^(?:input|select|textarea|button)$/i,gn=/^(?:a|area)$/i;function vn(e){return(e.match(j)||[]).join(" ")}function yn(e){return e.getAttribute&&e.getAttribute("class")||""}function mn(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(j)||[]}x.fn.extend({prop:function(e,n){return z(this,x.prop,e,n,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[x.propFix[e]||e]})}}),x.extend({prop:function(e,n,t){var l,r,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&x.isXMLDoc(e)||(r=x.propHooks[n=x.propFix[n]||n]),void 0!==t?r&&"set"in r&&void 0!==(l=r.set(e,t,n))?l:e[n]=t:r&&"get"in r&&null!==(l=r.get(e,n))?l:e[n]},propHooks:{tabIndex:{get:function(e){var n=x.find.attr(e,"tabindex");return n?parseInt(n,10):fn.test(e.nodeName)||gn.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),v.optSelected||(x.propHooks.selected={get:function(e){return null},set:function(e){}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.fn.extend({addClass:function(e){var n,t,l,r,o,i,u,s=0;if(y(e))return this.each(function(n){x(this).addClass(e.call(this,n,yn(this)))});if((n=mn(e)).length)for(;t=this[s++];)if(r=yn(t),l=1===t.nodeType&&" "+vn(r)+" "){for(i=0;o=n[i++];)l.indexOf(" "+o+" ")<0&&(l+=o+" ");r!==(u=vn(l))&&t.setAttribute("class",u)}return this},removeClass:function(e){var n,t,l,r,o,i,u,s=0;if(y(e))return this.each(function(n){x(this).removeClass(e.call(this,n,yn(this)))});if(!arguments.length)return this.attr("class","");if((n=mn(e)).length)for(;t=this[s++];)if(r=yn(t),l=1===t.nodeType&&" "+vn(r)+" "){for(i=0;o=n[i++];)for(;l.indexOf(" "+o+" ")>-1;)l=l.replace(" "+o+" "," ");r!==(u=vn(l))&&t.setAttribute("class",u)}return this},toggleClass:function(e,n){var t=typeof e,l="string"===t||Array.isArray(e);return"boolean"==typeof n&&l?n?this.addClass(e):this.removeClass(e):y(e)?this.each(function(t){x(this).toggleClass(e.call(this,t,yn(this),n),n)}):this.each(function(){var n,r,o,i;if(l)for(r=0,o=x(this),i=mn(e);n=i[r++];)o.hasClass(n)?o.removeClass(n):o.addClass(n);else void 0!==e&&"boolean"!==t||((n=yn(this))&&X.set(this,"__className__",n),this.setAttribute&&this.setAttribute("class",n||!1===e?"":X.get(this,"__className__")||""))})},hasClass:function(e){var n,t,l=0;for(n=" "+e+" ";t=this[l++];)if(1===t.nodeType&&(" "+vn(yn(t))+" ").indexOf(n)>-1)return!0;return!1}});var bn=/\r/g;x.fn.extend({val:function(e){var n,t,l,r=this[0];return arguments.length?(l=y(e),this.each(function(t){var r;1===this.nodeType&&(null==(r=l?e.call(this,t,x(this).val()):e)?r="":"number"==typeof r?r+="":Array.isArray(r)&&(r=x.map(r,function(e){return null==e?"":e+""})),(n=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()])&&"set"in n&&void 0!==n.set(this,r,"value")||(this.value=r))})):r?(n=x.valHooks[r.type]||x.valHooks[r.nodeName.toLowerCase()])&&"get"in n&&void 0!==(t=n.get(r,"value"))?t:"string"==typeof(t=r.value)?t.replace(bn,""):null==t?"":t:void 0}}),x.extend({valHooks:{option:{get:function(e){var n=x.find.attr(e,"value");return null!=n?n:vn(x.text(e))}},select:{get:function(e){var n,t,l,r=e.options,o=e.selectedIndex,i="select-one"===e.type,u=i?null:[],s=i?o+1:r.length;for(l=o<0?s:i?o:0;l-1)&&(t=!0);return t||(e.selectedIndex=-1),o}}}}),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){if(Array.isArray(n))return e.checked=x.inArray(x(e).val(),n)>-1}},v.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),v.focusin="onfocusin"in t;var _n=/^(?:focusinfocus|focusoutblur)$/,wn=function(e){e.stopPropagation()};x.extend(x.event,{trigger:function(e,n,l,r){var o,i,u,s,a,c,d,p,f=[l||b],g=h.call(e,"type")?e.type:e,v=h.call(e,"namespace")?e.namespace.split("."):[];if(i=p=u=l=l||b,3!==l.nodeType&&8!==l.nodeType&&!_n.test(g+x.event.triggered)&&(g.indexOf(".")>-1&&(g=(v=g.split(".")).shift(),v.sort()),a=g.indexOf(":")<0&&"on"+g,(e=e[x.expando]?e:new x.Event(g,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=v.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=l),n=null==n?[e]:x.makeArray(n,[e]),d=x.event.special[g]||{},r||!d.trigger||!1!==d.trigger.apply(l,n))){if(!r&&!d.noBubble&&!m(l)){for(_n.test((s=d.delegateType||g)+g)||(i=i.parentNode);i;i=i.parentNode)f.push(i),u=i;u===(l.ownerDocument||b)&&f.push(u.defaultView||u.parentWindow||t)}for(o=0;(i=f[o++])&&!e.isPropagationStopped();)p=i,e.type=o>1?s:d.bindType||g,(c=(X.get(i,"events")||Object.create(null))[e.type]&&X.get(i,"handle"))&&c.apply(i,n),(c=a&&i[a])&&c.apply&&Z(i)&&(e.result=c.apply(i,n),!1===e.result&&e.preventDefault());return e.type=g,r||e.isDefaultPrevented()||d._default&&!1!==d._default.apply(f.pop(),n)||!Z(l)||a&&y(l[g])&&!m(l)&&((u=l[a])&&(l[a]=null),x.event.triggered=g,e.isPropagationStopped()&&p.addEventListener(g,wn),l[g](),e.isPropagationStopped()&&p.removeEventListener(g,wn),x.event.triggered=void 0,u&&(l[a]=u)),e.result}},simulate:function(e,n,t){var l=x.extend(new x.Event,t,{type:e,isSimulated:!0});x.event.trigger(l,null,n)}}),x.fn.extend({trigger:function(e,n){return this.each(function(){x.event.trigger(e,n,this)})},triggerHandler:function(e,n){var t=this[0];if(t)return x.event.trigger(e,n,t,!0)}}),v.focusin||x.each({focus:"focusin",blur:"focusout"},function(e,n){var t=function(e){x.event.simulate(n,e.target,x.event.fix(e))};x.event.special[n]={setup:function(){var l=this.ownerDocument||this.document||this,r=X.access(l,n);r||l.addEventListener(e,t,!0),X.access(l,n,(r||0)+1)},teardown:function(){var l=this.ownerDocument||this.document||this,r=X.access(l,n)-1;r?X.access(l,n,r):(l.removeEventListener(e,t,!0),X.remove(l,n))}}});var Cn=t.location,xn={guid:Date.now()},En=/\?/;x.parseXML=function(e){var n,l;if(!e||"string"!=typeof e)return null;try{n=(new t.DOMParser).parseFromString(e,"text/xml")}catch(e){}return l=n&&n.getElementsByTagName("parsererror")[0],n&&!l||x.error("Invalid XML: "+(l?x.map(l.childNodes,function(e){return e.textContent}).join("\n"):e)),n};var Tn=/\[\]$/,Sn=/\r?\n/g,kn=/^(?:submit|button|image|reset|file)$/i,An=/^(?:input|select|textarea|keygen)/i;function Dn(e,n,t,l){var r;if(Array.isArray(n))x.each(n,function(n,r){t||Tn.test(e)?l(e,r):Dn(e+"["+("object"==typeof r&&null!=r?n:"")+"]",r,t,l)});else if(t||"object"!==C(n))l(e,n);else for(r in n)Dn(e+"["+r+"]",n[r],t,l)}x.param=function(e,n){var t,l=[],r=function(e,n){var t=y(n)?n():n;l[l.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==t?"":t)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){r(this.name,this.value)});else for(t in e)Dn(t,e[t],n,r);return l.join("&")},x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&An.test(this.nodeName)&&!kn.test(e)&&(this.checked||!ge.test(e))}).map(function(e,n){var t=x(this).val();return null==t?null:Array.isArray(t)?x.map(t,function(e){return{name:n.name,value:e.replace(Sn,"\r\n")}}):{name:n.name,value:t.replace(Sn,"\r\n")}}).get()}});var In=/%20/g,Nn=/#.*$/,Mn=/([?&])_=[^&]*/,On=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pn=/^(?:GET|HEAD)$/,Rn=/^\/\//,Vn={},jn={},Ln="*/".concat("*"),Fn=b.createElement("a");function Hn(e){return function(n,t){"string"!=typeof n&&(t=n,n="*");var l,r=0,o=n.toLowerCase().match(j)||[];if(y(t))for(;l=o[r++];)"+"===l[0]?(l=l.slice(1)||"*",(e[l]=e[l]||[]).unshift(t)):(e[l]=e[l]||[]).push(t)}}function Bn(e,n,t,l){var r={},o=e===jn;function i(u){var s;return r[u]=!0,x.each(e[u]||[],function(e,u){var a=u(n,t,l);return"string"!=typeof a||o||r[a]?o?!(s=a):void 0:(n.dataTypes.unshift(a),i(a),!1)}),s}return i(n.dataTypes[0])||!r["*"]&&i("*")}function Un(e,n){var t,l,r=x.ajaxSettings.flatOptions||{};for(t in n)void 0!==n[t]&&((r[t]?e:l||(l={}))[t]=n[t]);return l&&x.extend(!0,e,l),e}Fn.href=Cn.href,x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Cn.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Cn.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ln,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,n){return n?Un(Un(e,x.ajaxSettings),n):Un(x.ajaxSettings,e)},ajaxPrefilter:Hn(Vn),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=void 0);var l,r,o,i,u,s,a,c,d,p,h=x.ajaxSetup({},n=n||{}),f=h.context||h,g=h.context&&(f.nodeType||f.jquery)?x(f):x.event,v=x.Deferred(),y=x.Callbacks("once memory"),m=h.statusCode||{},_={},w={},C="canceled",E={readyState:0,getResponseHeader:function(e){var n;if(a){if(!i)for(i={};n=On.exec(o);)i[n[1].toLowerCase()+" "]=(i[n[1].toLowerCase()+" "]||[]).concat(n[2]);n=i[e.toLowerCase()+" "]}return null==n?null:n.join(", ")},getAllResponseHeaders:function(){return a?o:null},setRequestHeader:function(e,n){return null==a&&(e=w[e.toLowerCase()]=w[e.toLowerCase()]||e,_[e]=n),this},overrideMimeType:function(e){return null==a&&(h.mimeType=e),this},statusCode:function(e){var n;if(e)if(a)E.always(e[E.status]);else for(n in e)m[n]=[m[n],e[n]];return this},abort:function(e){var n=e||C;return l&&l.abort(n),T(0,n),this}};if(v.promise(E),h.url=((e||h.url||Cn.href)+"").replace(Rn,Cn.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(j)||[""],null==h.crossDomain){s=b.createElement("a");try{s.href=h.url,s.href=s.href,h.crossDomain=Fn.protocol+"//"+Fn.host!=s.protocol+"//"+s.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=x.param(h.data,h.traditional)),Bn(Vn,h,n,E),a)return E;for(d in(c=x.event&&h.global)&&0==x.active++&&x.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Pn.test(h.type),r=h.url.replace(Nn,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(In,"+")):(p=h.url.slice(r.length),h.data&&(h.processData||"string"==typeof h.data)&&(r+=(En.test(r)?"&":"?")+h.data,delete h.data),!1===h.cache&&(r=r.replace(Mn,"$1"),p=(En.test(r)?"&":"?")+"_="+xn.guid+++p),h.url=r+p),h.ifModified&&(x.lastModified[r]&&E.setRequestHeader("If-Modified-Since",x.lastModified[r]),x.etag[r]&&E.setRequestHeader("If-None-Match",x.etag[r])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+Ln+"; q=0.01":""):h.accepts["*"]),h.headers)E.setRequestHeader(d,h.headers[d]);if(h.beforeSend&&(!1===h.beforeSend.call(f,E,h)||a))return E.abort();if(C="abort",y.add(h.complete),E.done(h.success),E.fail(h.error),l=Bn(jn,h,n,E)){if(E.readyState=1,c&&g.trigger("ajaxSend",[E,h]),a)return E;h.async&&h.timeout>0&&(u=t.setTimeout(function(){E.abort("timeout")},h.timeout));try{a=!1,l.send(_,T)}catch(e){if(a)throw e;T(-1,e)}}else T(-1,"No Transport");function T(e,n,i,s){var d,p,b,_,w,C=n;a||(a=!0,u&&t.clearTimeout(u),l=void 0,o=s||"",E.readyState=e>0?4:0,d=e>=200&&e<300||304===e,i&&(_=function(e,n,t){for(var l,r,o,i,u=e.contents,s=e.dataTypes;"*"===s[0];)s.shift(),void 0===l&&(l=e.mimeType||n.getResponseHeader("Content-Type"));if(l)for(r in u)if(u[r]&&u[r].test(l)){s.unshift(r);break}if(s[0]in t)o=s[0];else{for(r in t){if(!s[0]||e.converters[r+" "+s[0]]){o=r;break}i||(i=r)}o=o||i}if(o)return o!==s[0]&&s.unshift(o),t[o]}(h,E,i)),!d&&x.inArray("script",h.dataTypes)>-1&&x.inArray("json",h.dataTypes)<0&&(h.converters["text script"]=function(){}),_=function(e,n,t,l){var r,o,i,u,s,a={},c=e.dataTypes.slice();if(c[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(o=c.shift();o;)if(e.responseFields[o]&&(t[e.responseFields[o]]=n),!s&&l&&e.dataFilter&&(n=e.dataFilter(n,e.dataType)),s=o,o=c.shift())if("*"===o)o=s;else if("*"!==s&&s!==o){if(!(i=a[s+" "+o]||a["* "+o]))for(r in a)if((u=r.split(" "))[1]===o&&(i=a[s+" "+u[0]]||a["* "+u[0]])){!0===i?i=a[r]:!0!==a[r]&&(o=u[0],c.unshift(u[1]));break}if(!0!==i)if(i&&e.throws)n=i(n);else try{n=i(n)}catch(e){return{state:"parsererror",error:i?e:"No conversion from "+s+" to "+o}}}return{state:"success",data:n}}(h,_,E,d),d?(h.ifModified&&((w=E.getResponseHeader("Last-Modified"))&&(x.lastModified[r]=w),(w=E.getResponseHeader("etag"))&&(x.etag[r]=w)),204===e||"HEAD"===h.type?C="nocontent":304===e?C="notmodified":(C=_.state,p=_.data,d=!(b=_.error))):(b=C,!e&&C||(C="error",e<0&&(e=0))),E.status=e,E.statusText=(n||C)+"",d?v.resolveWith(f,[p,C,E]):v.rejectWith(f,[E,C,b]),E.statusCode(m),m=void 0,c&&g.trigger(d?"ajaxSuccess":"ajaxError",[E,h,d?p:b]),y.fireWith(f,[E,C]),c&&(g.trigger("ajaxComplete",[E,h]),--x.active||x.event.trigger("ajaxStop")))}return E},getJSON:function(e,n,t){return x.get(e,n,t,"json")},getScript:function(e,n){return x.get(e,void 0,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,t,l,r){return y(t)&&(r=r||l,l=t,t=void 0),x.ajax(x.extend({url:e,type:n,dataType:r,data:t,success:l},x.isPlainObject(e)&&e))}}),x.ajaxPrefilter(function(e){var n;for(n in e.headers)"content-type"===n.toLowerCase()&&(e.contentType=e.headers[n]||"")}),x._evalUrl=function(e,n,t){return x.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){x.globalEval(e,n,t)}})},x.fn.extend({wrapAll:function(e){var n;return this[0]&&(y(e)&&(e=e.call(this[0])),n=x(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&n.insertBefore(this[0]),n.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return y(e)?this.each(function(n){x(this).wrapInner(e.call(this,n))}):this.each(function(){var n=x(this),t=n.contents();t.length?t.wrapAll(e):n.append(e)})},wrap:function(e){var n=y(e);return this.each(function(t){x(this).wrapAll(n?e.call(this,t):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){x(this).replaceWith(this.childNodes)}),this}}),x.expr.pseudos.hidden=function(e){return!x.expr.pseudos.visible(e)},x.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},x.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(e){}};var qn={0:200,1223:204},zn=x.ajaxSettings.xhr();v.cors=!!zn&&"withCredentials"in zn,v.ajax=zn=!!zn,x.ajaxTransport(function(e){var n,l;if(v.cors||zn&&!e.crossDomain)return{send:function(r,o){var i,u=e.xhr();if(u.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(i in e.xhrFields)u[i]=e.xhrFields[i];for(i in e.mimeType&&u.overrideMimeType&&u.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)u.setRequestHeader(i,r[i]);n=function(e){return function(){n&&(n=l=u.onload=u.onerror=u.onabort=u.ontimeout=u.onreadystatechange=null,"abort"===e?u.abort():"error"===e?"number"!=typeof u.status?o(0,"error"):o(u.status,u.statusText):o(qn[u.status]||u.status,u.statusText,"text"!==(u.responseType||"text")||"string"!=typeof u.responseText?{binary:u.response}:{text:u.responseText},u.getAllResponseHeaders()))}},u.onload=n(),l=u.onerror=u.ontimeout=n("error"),void 0!==u.onabort?u.onabort=l:u.onreadystatechange=function(){4===u.readyState&&t.setTimeout(function(){n&&l()})},n=n("abort");try{u.send(e.hasContent&&e.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),x.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),x.ajaxTransport("script",function(e){var n,t;if(e.crossDomain||e.scriptAttrs)return{send:function(l,r){n=x("{% endassets %}
{% assets "weko_admin_react_bootstrap_js" %}{% endassets %}
{% assets "weko_items_ui_feedback_maillist_js" %}{% endassets %}
+ {% assets "weko_items_ui_request_maillist_js" %}{% endassets %}
{{ super() }}
{% assets "invenio_deposit_js" %}{% endassets %}
{% assets "weko_items_ui_js" %}{% endassets %}
@@ -182,7 +183,7 @@
Contributor
-
@@ -236,7 +244,10 @@ Contributor
{%- block feedback_mail_list %}
+
+
+
diff --git a/modules/weko-items-ui/weko_items_ui/templates/weko_items_ui/iframe/item_edit.html b/modules/weko-items-ui/weko_items_ui/templates/weko_items_ui/iframe/item_edit.html
index f20048345c..713e4772d9 100644
--- a/modules/weko-items-ui/weko_items_ui/templates/weko_items_ui/iframe/item_edit.html
+++ b/modules/weko-items-ui/weko_items_ui/templates/weko_items_ui/iframe/item_edit.html
@@ -46,6 +46,8 @@
{% assets "invenio_deposit_dependencies_js" %}{% endassets %}
{% assets "weko_admin_react_bootstrap_js" %}{% endassets %}
{% assets "weko_items_ui_feedback_maillist_js" %}{% endassets %}
+ {% assets "weko_items_ui_request_maillist_js" %}{% endassets %}
+ {% assets "weko_items_ui_no_file_approval_js" %}{% endassets %}
{{ super() }}
{% assets "invenio_deposit_js" %}{% endassets %}
{%- if need_thumbnail %}
@@ -174,7 +176,7 @@ {{_('Thumbnail')}}
{%- endif %}
-
+
{%- if is_show_autofill_metadata %}
@@ -203,7 +205,7 @@
{{_('Thumbnail')}}
Contributor
-
+
@@ -279,7 +280,10 @@
Contributor
{%- block feedback_mail_list %}
+
+
+
@@ -292,6 +296,14 @@
Contributor
{%- endblock feedback_mail_list %}
+ {%- block none_contents_approval %}
+
+
+
+
+
+ {%- endblock none_contents_approval %}
+
{% if record|length %}
{%- block radio_version_management %}
@@ -328,13 +340,13 @@
Contributor
{%- endif %}
+ ng-click="saveDataJson('{{item_save_uri}}',{{action_id}},'{{enable_contributor}}','{{enable_feedback_maillist}}', '{{enable_request_maillist}}', true, false);">
 
{{_('Save')}}
{{_('Next')}} 
+ ng-click="updateDataJson('{{activity_id}}',{{steps}},'{{item_save_uri}}',{{action_id}},'{{is_auto_set_index_action}}','{{enable_contributor}}','{{enable_feedback_maillist}}', '{{enable_request_maillist}}')"> {{_('Next')}} 
@@ -448,6 +460,7 @@
Contributor
+
{% set position_err_msg = "Position is being inputted (Only input when selecting 'Others')" %}
@@ -460,6 +473,8 @@
Contributor
value="{{_('The following items is required. Please recheck and input.')}}">
+
Contributor
value='{{usage_type}}'>
-
-
-
+
+
-
-
-
-
+
+
+
+
+
+ {% if user.owner %}
+
+ Owner
+ {% else %}
+
+ Contributor
+ {% endif %}
+
+
+
+ Email
+
+
+
+ {% if user.owner %}
+
+ {% else %}
+
+ {% endif %}
+
+
+
+
+{% endfor %}
\ No newline at end of file
diff --git a/modules/weko-items-ui/weko_items_ui/templates/weko_items_ui/iframe/item_edit_contributor_new_row.html b/modules/weko-items-ui/weko_items_ui/templates/weko_items_ui/iframe/item_edit_contributor_new_row.html
new file mode 100644
index 0000000000..501d0ddfe0
--- /dev/null
+++ b/modules/weko-items-ui/weko_items_ui/templates/weko_items_ui/iframe/item_edit_contributor_new_row.html
@@ -0,0 +1,46 @@
+{#
+ # This file is part of WEKO3.
+ # Copyright (C) 2017 National Institute of Informatics.
+ #
+ # WEKO3 is free software; you can redistribute it
+ # and/or modify it under the terms of the GNU General Public License as
+ # published by the Free Software Foundation; either version 2 of the
+ # License, or (at your option) any later version.
+ #
+ # WEKO3 is distributed in the hope that it will be
+ # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ # General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with WEKO3; if not, write to the
+ # Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ # MA 02111-1307, USA.
+ #}
+
+
+
+
+ Username
+
+
+
+
+ Email
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/weko-items-ui/weko_items_ui/translations/en/LC_MESSAGES/messages.mo b/modules/weko-items-ui/weko_items_ui/translations/en/LC_MESSAGES/messages.mo
index f069dfd0fb..bfd5667857 100644
Binary files a/modules/weko-items-ui/weko_items_ui/translations/en/LC_MESSAGES/messages.mo and b/modules/weko-items-ui/weko_items_ui/translations/en/LC_MESSAGES/messages.mo differ
diff --git a/modules/weko-items-ui/weko_items_ui/translations/en/LC_MESSAGES/messages.po b/modules/weko-items-ui/weko_items_ui/translations/en/LC_MESSAGES/messages.po
index 637760243c..a5f220947a 100644
--- a/modules/weko-items-ui/weko_items_ui/translations/en/LC_MESSAGES/messages.po
+++ b/modules/weko-items-ui/weko_items_ui/translations/en/LC_MESSAGES/messages.po
@@ -66,6 +66,10 @@ msgstr "Specified ID does not exist."
msgid "Item cannot be edited because the import is in progress."
msgstr ""
+#: weko_items_ui/views.py:848
+msgid "Logged-in user cannot be deleted."
+msgstr "Logged-in user cannot be deleted."
+
#: weko_items_ui/views.py:854
msgid "This Item is being edited."
msgstr ""
@@ -594,6 +598,9 @@ msgstr ""
#~ msgid "Guest"
#~ msgstr "Guest"
+msgid "The approver email address cannot be the same as the applicant. Please recheck and input."
+msgstr ""
+
#~ msgid "Free Input"
#~ msgstr "Free Input"
@@ -606,3 +613,14 @@ msgstr ""
#~ "you do not have permission to view"
#~ " it."
+msgid "Request Mail Destination"
+msgstr ""
+
+msgid "Display Request Mail Button"
+msgstr ""
+
+msgid "error message for item application"
+msgstr "When uploading a file, you cannot set usage request workflow for the item."
+
+msgid "Set usage application workflow for item"
+msgstr ""
\ No newline at end of file
diff --git a/modules/weko-items-ui/weko_items_ui/translations/ja/LC_MESSAGES/messages.mo b/modules/weko-items-ui/weko_items_ui/translations/ja/LC_MESSAGES/messages.mo
index 28f160d45c..cdc84ca27a 100644
Binary files a/modules/weko-items-ui/weko_items_ui/translations/ja/LC_MESSAGES/messages.mo and b/modules/weko-items-ui/weko_items_ui/translations/ja/LC_MESSAGES/messages.mo differ
diff --git a/modules/weko-items-ui/weko_items_ui/translations/ja/LC_MESSAGES/messages.po b/modules/weko-items-ui/weko_items_ui/translations/ja/LC_MESSAGES/messages.po
index 20b2e48165..2acf2ce933 100644
--- a/modules/weko-items-ui/weko_items_ui/translations/ja/LC_MESSAGES/messages.po
+++ b/modules/weko-items-ui/weko_items_ui/translations/ja/LC_MESSAGES/messages.po
@@ -70,6 +70,10 @@ msgstr "レコードが存在しません"
msgid "Item cannot be edited because the import is in progress."
msgstr "インポートを実行中のためアイテムの編集はできません。"
+#: weko_items_ui/views.py:848
+msgid "Logged-in user cannot be deleted."
+msgstr "ログインユーザーは削除できません。"
+
#: weko_items_ui/views.py:854
#, fuzzy
msgid "This Item is being edited."
@@ -580,33 +584,44 @@ msgstr "インポート"
#~ msgid "Advisor"
#~ msgstr "指導教員"
-#~ msgid "Guarantor"
-#~ msgstr "保証人"
+#~ msgid "Cannot preview because the file size is too large."
+#~ msgstr "ファイルサイズが大きいためプレビューできません。"
-#~ msgid "Email (Advisor)"
-#~ msgstr "メール(指導教員)"
+msgid "Guarantor"
+msgstr "保証人"
-#~ msgid "Email (Guarantor)"
-#~ msgstr "メール(保証人)"
+msgid "Email (Advisor)"
+msgstr "メール(指導教員)"
-#~ msgid "Required item is not inputted"
-#~ msgstr "必須項目がありません。"
+msgid "Email (Guarantor)"
+msgstr "メール(保証人)"
-#~ msgid "Cannot preview because the file size is too large."
-#~ msgstr "ファイルサイズが大きいためプレビューできません。"
+msgid "The approver email address cannot be the same as the applicant. Please recheck and input."
+msgstr "承認者のメールアドレスが申請者と同じにすることはできません。ご確認の上、再度入力してください。"
-#~ msgid "Item cannot be deleted because the import is in progress."
-#~ msgstr "インポートを実行中のためアイテムの削除はできません。"
+msgid "Required item is not inputted"
+msgstr "必須項目がありません。"
-#~ msgid "Guest"
-#~ msgstr "非ログインユーザー"
+msgid "Item cannot be deleted because the import is in progress."
+msgstr "インポートを実行中のためアイテムの削除はできません。"
-#~ msgid "Free Input"
-#~ msgstr "自由入力"
+msgid "Guest"
+msgstr "非ログインユーザー"
-#~ msgid ""
-#~ "The item cannot be copied because "
-#~ "you do not have permission to view"
-#~ " it."
-#~ msgstr "該当アイテムの参照権限がないため流用できません。"
+msgid "Free Input"
+msgstr "自由入力"
+
+msgid "The item cannot be copied because you do not have permission to view it."
+msgstr "該当アイテムの参照権限がないため流用できません。"
+
+msgid "Request Mail Destination"
+msgstr "リクエストメール送信先"
+
+msgid "Display Request Mail Button"
+msgstr "リクエストボタンを表示"
+
+msgid "error message for item application"
+msgstr "ファイルアップロード時は、アイテムに対し利用申請ワークフローを設定はできません。"
+msgid "Set usage application workflow for item"
+msgstr "アイテムに利用申請ワークフローを設定"
\ No newline at end of file
diff --git a/modules/weko-items-ui/weko_items_ui/translations/messages.pot b/modules/weko-items-ui/weko_items_ui/translations/messages.pot
index 9f87cdc333..f22641f1b9 100644
--- a/modules/weko-items-ui/weko_items_ui/translations/messages.pot
+++ b/modules/weko-items-ui/weko_items_ui/translations/messages.pot
@@ -1,15 +1,15 @@
# Translations template for weko-items-ui.
-# Copyright (C) 2022 National Institute of Informatics
+# Copyright (C) 2023 National Institute of Informatics
# This file is distributed under the same license as the weko-items-ui
# project.
-# FIRST AUTHOR
, 2022.
+# FIRST AUTHOR , 2023.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: weko-items-ui 0.1.0.dev20170000\n"
"Report-Msgid-Bugs-To: wekosoftware@nii.ac.jp\n"
-"POT-Creation-Date: 2022-01-25 23:50+0000\n"
+"POT-Creation-Date: 2023-08-19 21:16+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -18,76 +18,81 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.5.1\n"
-#: weko_items_ui/utils.py:497 weko_items_ui/utils.py:2231
-#: weko_items_ui/utils.py:2252
+#: weko_items_ui/utils.py:578 weko_items_ui/utils.py:2374
+#: weko_items_ui/utils.py:2395
msgid "Please input all required item."
msgstr ""
-#: weko_items_ui/utils.py:499
+#: weko_items_ui/utils.py:580
msgid "Please input the correct data."
msgstr ""
-#: weko_items_ui/utils.py:1387
+#: weko_items_ui/utils.py:1499
msgid "Error occurred during item export."
msgstr ""
-#: weko_items_ui/views.py:371
+#: weko_items_ui/views.py:406
msgid "Invalid request"
msgstr ""
-#: weko_items_ui/views.py:485
+#: weko_items_ui/views.py:543
msgid "Invalid Request"
msgstr ""
-#: weko_items_ui/views.py:649 weko_items_ui/views.py:686
-#: weko_items_ui/views.py:790
+#: weko_items_ui/views.py:716 weko_items_ui/views.py:753
+#: weko_items_ui/views.py:814 weko_items_ui/views.py:992
+#: weko_items_ui/views.py:996
msgid "Header Error"
msgstr ""
-#: weko_items_ui/views.py:814
+#: weko_items_ui/views.py:924 weko_items_ui/views.py:947
+msgid "Logged-in user cannot be deleted."
+msgstr ""
+
+#: weko_items_ui/views.py:1019
msgid "You are not allowed to edit this item."
msgstr ""
-#: weko_items_ui/views.py:821
+#: weko_items_ui/views.py:1026
msgid "You do not even have an ItemType."
msgstr ""
-#: weko_items_ui/views.py:829
+#: weko_items_ui/views.py:1034
msgid "Dependency ItemType not found."
msgstr ""
-#: weko_items_ui/views.py:835
+#: weko_items_ui/views.py:1040
msgid "Record does not exist."
msgstr ""
-#: weko_items_ui/views.py:842
+#: weko_items_ui/views.py:1047
msgid "Item cannot be edited because the import is in progress."
msgstr ""
-#: weko_items_ui/views.py:854
+#: weko_items_ui/views.py:1059
msgid "This Item is being edited."
msgstr ""
-#: weko_items_ui/views.py:868
+#: weko_items_ui/views.py:1073
msgid "Workflow setting does not exist."
msgstr ""
-#: weko_items_ui/views.py:884 weko_items_ui/views.py:891
-#: weko_items_ui/views.py:911
+#: weko_items_ui/views.py:1089 weko_items_ui/views.py:1096
+#: weko_items_ui/views.py:1116
msgid "An error has occurred."
msgstr ""
-#: weko_items_ui/views.py:1081
+#: weko_items_ui/views.py:1299
msgid "PID does not meet the conditions."
msgstr ""
-#: weko_items_ui/views.py:1083
+#: weko_items_ui/views.py:1301
msgid ""
"The mapping of required items for DOI validation is not set. Please "
"recheck the following mapping settings. {}"
msgstr ""
-#: weko_items_ui/views.py:1157
+#: weko_items_ui/views.py:1374
msgid "Your session has timed out. Please login again."
msgstr ""
@@ -96,18 +101,18 @@ msgid "Itemtype List"
msgstr ""
#: weko_items_ui/templates/weko_items_ui/edit.html:104
-#: weko_items_ui/templates/weko_items_ui/edit.html:252
+#: weko_items_ui/templates/weko_items_ui/edit.html:259
#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:118
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:337
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:336
msgid "Next"
msgstr ""
#: weko_items_ui/templates/weko_items_ui/edit.html:118
-#: weko_items_ui/templates/weko_items_ui/edit.html:241
-#: weko_items_ui/templates/weko_items_ui/edit.html:262
+#: weko_items_ui/templates/weko_items_ui/edit.html:248
+#: weko_items_ui/templates/weko_items_ui/edit.html:269
#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:130
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:284
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:326
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:283
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:325
msgid "Delete"
msgstr ""
@@ -116,81 +121,81 @@ msgstr ""
msgid "Automatic Metadata Input"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:239
+#: weko_items_ui/templates/weko_items_ui/edit.html:246
msgid "フィードバックメール送信先"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:240
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:283
+#: weko_items_ui/templates/weko_items_ui/edit.html:247
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:282
msgid "From author DB"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:242
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:285
+#: weko_items_ui/templates/weko_items_ui/edit.html:249
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:284
msgid "Input text"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:243
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:286
+#: weko_items_ui/templates/weko_items_ui/edit.html:250
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:285
msgid "Duplicate Email Addresses."
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:244
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:287
+#: weko_items_ui/templates/weko_items_ui/edit.html:251
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:286
msgid "Invalid email format."
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:290
-#: weko_items_ui/templates/weko_items_ui/edit.html:322
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:288
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:377
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:394
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:512
+#: weko_items_ui/templates/weko_items_ui/edit.html:297
+#: weko_items_ui/templates/weko_items_ui/edit.html:329
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:287
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:376
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:393
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:513
#: weko_items_ui/templates/weko_items_ui/iframe/item_index.html:312
#: weko_items_ui/templates/weko_items_ui/upload.html:100
msgid "Close"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:302
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:443
+#: weko_items_ui/templates/weko_items_ui/edit.html:309
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:442
msgid "Please select the ID."
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:304
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:444
+#: weko_items_ui/templates/weko_items_ui/edit.html:311
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:443
msgid "Please input value."
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:306
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:446
+#: weko_items_ui/templates/weko_items_ui/edit.html:313
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:445
msgid "Specified ID does not exist."
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:308
-#: weko_items_ui/templates/weko_items_ui/edit.html:310
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:455
+#: weko_items_ui/templates/weko_items_ui/edit.html:315
+#: weko_items_ui/templates/weko_items_ui/edit.html:317
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:454
msgid "Automatic metadata input"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:311
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:458
+#: weko_items_ui/templates/weko_items_ui/edit.html:318
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:457
msgid "Get"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:313
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:460
+#: weko_items_ui/templates/weko_items_ui/edit.html:320
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:459
msgid "The following items is required. Please recheck and input."
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:315
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:462
+#: weko_items_ui/templates/weko_items_ui/edit.html:322
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:461
msgid ""
"The following email address is not registered in the system. Please "
"recheck and input."
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/edit.html:317
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:466
+#: weko_items_ui/templates/weko_items_ui/edit.html:324
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:467
msgid "Please input email address."
msgstr ""
@@ -306,73 +311,79 @@ msgstr ""
msgid "Registerable file: 「gif, jpg, jpe, jpeg, png, bmp」"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:282
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:281
msgid "Feedback Mail Destination"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:289
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:288
msgid "Search"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:290
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:289
msgid "Name"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:291
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:290
msgid "Mail address"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:292
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:291
msgid "Feedback Mail Import"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:301
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:300
msgid "Version Management"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:306
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:305
msgid "Upgrade Version"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:310
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:309
msgid "Keep Version"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:333
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:332
msgid "Save"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:347
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:346
msgid "QuitQO"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:445
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:444
msgid "Specified index does not exist"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:453
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:452
msgid "Position not provided."
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:464
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:463
+msgid ""
+"The approver email address cannot be the same as the applicant. Please "
+"recheck and input."
+msgstr ""
+
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:465
msgid "Can not found the email address of approval."
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:468
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:469
msgid ""
"The specified number has been exceeded. You can only select up to two "
"fields."
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:470
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:471
msgid "The same file name cannot be registered."
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:472
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:473
msgid "Thumbnail file type error message"
msgstr ""
-#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:474
+#: weko_items_ui/templates/weko_items_ui/iframe/item_edit.html:475
msgid "is too long."
msgstr ""
diff --git a/modules/weko-items-ui/weko_items_ui/utils.py b/modules/weko-items-ui/weko_items_ui/utils.py
index ef6a233e68..0d65f754ba 100644
--- a/modules/weko-items-ui/weko_items_ui/utils.py
+++ b/modules/weko-items-ui/weko_items_ui/utils.py
@@ -61,7 +61,7 @@
from weko_index_tree.api import Indexes
from weko_index_tree.utils import check_index_permissions, get_index_id, \
get_user_roles
-from weko_records.api import FeedbackMailList, ItemTypes, Mapping
+from weko_records.api import FeedbackMailList, RequestMailList, ItemTypes, Mapping, ItemApplication
from weko_records.serializers.utils import get_item_type_name
from weko_records.utils import replace_fqdn_of_file_metadata
from weko_records_ui.permissions import check_created_id, \
@@ -80,22 +80,28 @@
FlowDefine
from weko_workflow.utils import IdentifierHandle
+def check_display_shared_user(user_id):
+ for role_id in current_app.config['WEKO_ITEMS_UI_SHARED_USER_ROLE_ID_LIST']:
+ recs = db.session.query(userrole).filter_by(role_id=role_id).all()
+ for rec in recs:
+ if user_id == rec.user_id:
+ return True
+ return False
def get_list_username():
"""Get list username.
Query database to get all available username
return: list of username
- TODO:
"""
- current_user_id = current_user.get_id()
- current_app.logger.debug("current_user:{}".format(current_user))
from weko_user_profiles.models import UserProfile
- users = UserProfile.query.filter(UserProfile.user_id != current_user_id).all()
+ users = UserProfile.query.all()
result = list()
for user in users:
- username = user.get_username
+ if not check_display_shared_user(user.user_id):
+ continue
+ username = user.username
if username:
result.append(username)
@@ -108,28 +114,14 @@ def get_list_email():
Query database to get all available email
return: list of email
"""
- current_user_id = current_user.get_id()
result = list()
- users = User.query.filter(User.id != current_user_id).all()
+ users = User.query.all()
for user in users:
+ if not check_display_shared_user(user.id):
+ continue
email = user.email
if email:
result.append(email)
- # try:
- # metadata = MetaData()
- # metadata.reflect(bind=db.engine)
- # table_name = 'accounts_user'
-
- # user_table = Table(table_name, metadata)
- # record = db.session.query(user_table)
-
- # data = record.all()
-
- # for item in data:
- # if not int(current_user_id) == item[0]:
- # result.append(item[1])
- # except Exception as e:
- # result = str(e)
return result
@@ -137,7 +129,7 @@ def get_list_email():
def get_user_info_by_username(username):
"""Get user information by username.
- Query database to get user id by using username
+ Query database to get user id by using displayname
Get email from database using user id
Pack response data: user id, user name, email
@@ -147,7 +139,7 @@ def get_user_info_by_username(username):
"""
result = dict()
try:
- user = UserProfile.get_by_username(username)
+ user = UserProfile.get_by_displayname(username)
user_id = user.user_id
metadata = MetaData()
@@ -160,7 +152,7 @@ def get_user_info_by_username(username):
data = record.all()
for item in data:
- if item[0] == user_id:
+ if item[0] == user_id and check_display_shared_user(user_id):
result['username'] = username
result['user_id'] = user_id
result['email'] = item[1]
@@ -192,7 +184,7 @@ def validate_user(username, email):
'error': ''
}
try:
- user = UserProfile.get_by_username(username)
+ user = UserProfile.get_by_displayname(username)
user_id = 0
metadata = MetaData()
@@ -208,8 +200,10 @@ def validate_user(username, email):
if item[1] == email:
user_id = item[0]
break
-
- if user.user_id == user_id:
+ if user is None:
+ result['error'] = 'User is not exist UserProfile'
+ return result
+ if user.user_id == user_id and check_display_shared_user(user_id):
user_info = dict()
user_info['username'] = username
user_info['user_id'] = user_id
@@ -246,12 +240,12 @@ def get_user_info_by_email(email):
data = record.all()
for item in data:
- if item[1] == email:
+ if item[1] == email and check_display_shared_user(item[0]):
user = UserProfile.get_by_userid(item[0])
if user is None:
result['username'] = ""
else:
- result['username'] = user.get_username
+ result['username'] = user.username
result['user_id'] = item[0]
result['email'] = email
return result
@@ -260,27 +254,19 @@ def get_user_info_by_email(email):
result['error'] = str(e)
-def get_user_information(user_id):
+def get_user_information(user_ids):
"""
- Get user information user_id.
+ Get user information user_id list.
Query database to get email by using user_id
Get username from database using user id
- Pack response data: user id, user name, email
+ Pack response data list: [ user id, user name, email ]
parameter:
- user_id: The user_id
+ user_ids: The user_id list
return: response
"""
- result = {
- 'username': '',
- 'email': '',
- 'fullname': '',
- }
- user_info = UserProfile.get_by_userid(user_id)
- if user_info is not None:
- result['username'] = user_info.get_username
- result['fullname'] = user_info.fullname
+ result = []
metadata = MetaData()
metadata.reflect(bind=db.engine)
@@ -291,14 +277,35 @@ def get_user_information(user_id):
data = record.all()
- for item in data:
- if item[0] == user_id:
- result['email'] = item[1]
- return result
+ if type(user_ids) is int:
+ user_ids = [user_ids]
+ for user_id in user_ids:
+ info = {
+ 'userid':'',
+ 'username': '',
+ 'email': '',
+ 'fullname': '',
+ 'error': ''
+ }
+ user_info = UserProfile.get_by_userid(user_id)
+ if user_info is not None:
+ info['userid'] = user_id
+ info['username'] = user_info.get_username
+ info['fullname'] = user_info.fullname
+ else:
+ info['userid'] = user_id
+
+ temp = list(map(lambda x : x[0], data))
+ if not user_id in temp:
+ info['error'] = "The specified user ID is incorrect"
+
+ for item in data:
+ if int(item[0]) == int(user_id):
+ info['email'] = item[1]
+ result.append(info)
return result
-
def get_user_permission(user_id):
"""
Get user permission user_id.
@@ -316,7 +323,6 @@ def get_user_permission(user_id):
return True
return False
-
def get_current_user():
"""
Get user id of user currently login.
@@ -953,6 +959,33 @@ def get_max_ins_feedback_mail(self):
return self.attr_data['feedback_mail_list']['max_size']
+ def get_max_ins_request_mail(self):
+ """Get max data each request mail in all exporting records."""
+ largest_size = 1
+ self.attr_data['request_mail_list'] = {'max_size': 0}
+ for record_id, record in self.records.items():
+ if check_created_id(record):
+ mail_list = RequestMailList.get_mail_list_by_item_id(
+ record.id)
+ self.attr_data['request_mail_list'][record_id] = [
+ mail.get('email') for mail in mail_list]
+ if len(mail_list) > largest_size:
+ largest_size = len(mail_list)
+ self.attr_data['request_mail_list']['max_size'] = largest_size
+
+ return self.attr_data['request_mail_list']['max_size']
+
+ # 利用申請を取得する内部メソッド
+ def get_item_application(self):
+ self.attr_data['item_application']={}
+ for record_id, record in self.records.items():
+ if check_created_id(record):
+ item_application = ItemApplication.get_item_application_by_item_id(record.id)
+ self.attr_data['item_application'][record_id] = {'workflow':item_application.get('workflow',""),
+ 'terms':item_application.get('terms',""),
+ 'termsDescription':item_application.get('termsDescription',"")}
+ return 0
+
def get_max_items(self, item_attrs):
"""Get max data each sub property in all exporting records."""
max_length = 0
@@ -1138,8 +1171,17 @@ def get_subs_item(self,
ret.append('.feedback_mail[{}]'.format(i))
ret_label.append('.FEEDBACK_MAIL[{}]'.format(i))
- ret.extend(['.cnri', '.doi_ra', '.doi', '.edit_mode'])
- ret_label.extend(['.CNRI', '.DOI_RA', '.DOI', 'Keep/Upgrade Version'])
+ max_request_mail = records.get_max_ins_request_mail()
+ for i in range(max_request_mail):
+ ret.append('.request_mail[{}]'.format(i))
+ ret_label.append('.REQUEST_MAIL[{}]'.format(i))
+
+ records.get_item_application()
+
+ ret.extend(['.item_application.workflow','.item_application.terms','.item_application.termsDescription',
+ '.cnri', '.doi_ra', '.doi', '.edit_mode'])
+ ret_label.extend(['.ITEM_APPLICATION.WORKFLOW','.ITEM_APPLICATION.TERMS','.ITEM_APPLICATION.TERMS_DESCRIPTION',
+ '.CNRI', '.DOI_RA', '.DOI', 'Keep/Upgrade Version'])
has_pubdate = len([
record for _, record in records.records.items()
if record.get('pubdate')
@@ -1176,6 +1218,18 @@ def get_subs_item(self,
[''] * (max_feedback_mail - len(feedback_mail_list))
)
+ request_mail_list = records.attr_data['request_mail_list'] \
+ .get(recid, [])
+ records.attr_output[recid].extend(request_mail_list)
+ records.attr_output[recid].extend(
+ [''] * (max_request_mail - len(request_mail_list))
+ )
+
+ item_application = records.attr_data['item_application'].get(recid, {})
+ records.attr_output[recid].append(item_application.get('workflow',''))
+ records.attr_output[recid].append(item_application.get('terms',''))
+ records.attr_output[recid].append(item_application.get('termsDescription',''))
+
pid_cnri = record.pid_cnri
cnri = ''
if pid_cnri:
@@ -1263,7 +1317,7 @@ def get_subs_item(self,
ret_system = []
ret_option = []
multiple_option = ['.metadata.path', '.pos_index',
- '.feedback_mail', '.file_path', '.thumbnail_path']
+ '.feedback_mail', '.request_mail', '.file_path', '.thumbnail_path']
meta_list = item_type.get('meta_list', {})
meta_list.update(item_type.get('meta_fix', {}))
form = item_type.get('table_row_map', {}).get('form', {})
@@ -1575,7 +1629,7 @@ def del_hide_sub_metadata(keys, metadata):
exported_item['name'] = 'recid_{}'.format(record_id)
exported_item['files'] = []
exported_item['path'] = 'recid_' + str(record_id)
- exported_item['item_type_id'] = record.get('item_type_id')
+ exported_item['item_type_id'] = str(record.get('item_type_id')) if record.get('item_type_id') else None
if not records_data:
records_data = record
if exported_item['item_type_id']:
@@ -1587,10 +1641,10 @@ def del_hide_sub_metadata(keys, metadata):
False, False)
record_role_ids = {
'weko_creator_id': meta_data.get('weko_creator_id'),
- 'weko_shared_id': meta_data.get('weko_shared_id')
+ 'weko_shared_ids': meta_data.get('weko_shared_ids')
}
list_item_role.update(
- {exported_item['item_type_id']: record_role_ids})
+ {str(exported_item['item_type_id']): record_role_ids})
if hide_meta_data_for_role(record_role_ids):
for hide_key in list_hidden:
if isinstance(hide_key, str) \
@@ -2100,7 +2154,7 @@ def hide_meta_data_for_role(record):
# Item Register users and Sharing users
if record and current_user.get_id() in [
record.get('weko_creator_id'),
- str(record.get('weko_shared_id'))]:
+ str(record.get('weko_shared_ids'))]:
is_hidden = False
return is_hidden
@@ -2628,14 +2682,15 @@ def save_title(activity_id, request_data):
"""
activity = WorkActivity()
db_activity = activity.get_activity_detail(activity_id)
- item_type_id = db_activity.workflow.itemtype.id
- if item_type_id:
- item_type_mapping = Mapping.get_record(item_type_id)
- # current_app.logger.debug("item_type_mapping:{}".format(item_type_mapping))
- key, key_child = get_key_title_in_item_type_mapping(item_type_mapping)
- if key and key_child:
- title = get_title_in_request(request_data, key, key_child)
- activity.update_title(activity_id, title)
+ if db_activity and db_activity.workflow:
+ item_type_id = db_activity.workflow.itemtype.id
+ if item_type_id:
+ item_type_mapping = Mapping.get_record(item_type_id)
+ # current_app.logger.debug("item_type_mapping:{}".format(item_type_mapping))
+ key, key_child = get_key_title_in_item_type_mapping(item_type_mapping)
+ if key and key_child:
+ title = get_title_in_request(request_data, key, key_child)
+ activity.update_title(activity_id, title)
def get_key_title_in_item_type_mapping(item_type_mapping):
@@ -2897,6 +2952,33 @@ def get_max_ins_feedback_mail(self):
return self.attr_data['feedback_mail_list']['max_size']
+ def get_max_ins_request_mail(self):
+ """Get max data each request mail in all exporting records."""
+ largest_size = 1
+ self.attr_data['request_mail_list'] = {'max_size': 0}
+ for record_id, record in self.records.items():
+ if permissions['check_created_id'](record):
+ mail_list = RequestMailList.get_mail_list_by_item_id(
+ record.id)
+ self.attr_data['request_mail_list'][record_id] = [
+ mail.get('email') for mail in mail_list]
+ if len(mail_list) > largest_size:
+ largest_size = len(mail_list)
+ self.attr_data['request_mail_list']['max_size'] = largest_size
+
+ return self.attr_data['request_mail_list']['max_size']
+
+ # 利用申請を取得する内部メソッド
+ def get_item_application(self):
+ self.attr_data['item_application']={}
+ for record_id, record in self.records.items():
+ if permissions['check_created_id'](record):
+ item_application = ItemApplication.get_item_application_by_item_id(record.id)
+ self.attr_data['item_application'][record_id] = {'workflow':item_application.get('workflow',""),
+ 'terms':item_application.get('terms',""),
+ 'termsDescription':item_application.get('termsDescription',"")}
+ return 0
+
def get_max_items(self, item_attrs):
"""Get max data each sub property in all exporting records."""
max_length = 0
@@ -3081,9 +3163,16 @@ def get_subs_item(self,
for i in range(max_feedback_mail):
ret.append('.feedback_mail[{}]'.format(i))
ret_label.append('.FEEDBACK_MAIL[{}]'.format(i))
-
- ret.extend(['.cnri', '.doi_ra', '.doi', '.edit_mode'])
- ret_label.extend(['.CNRI', '.DOI_RA', '.DOI', 'Keep/Upgrade Version'])
+ max_request_mail = records.get_max_ins_request_mail()
+ for i in range(max_request_mail):
+ ret.append('.request_mail[{}]'.format(i))
+ ret_label.append('.REQUEST_MAIL[{}]'.format(i))
+
+ records.get_item_application()
+ ret.extend(['.item_application.workflow','.item_application.terms','.item_application.termsDescription',
+ '.cnri', '.doi_ra', '.doi', '.edit_mode'])
+ ret_label.extend(['.ITEM_APPLICATION.WORKFLOW','.ITEM_APPLICATION.TERMS','.ITEM_APPLICATION.TERMS_DESCRIPTION',
+ '.CNRI', '.DOI_RA', '.DOI', 'Keep/Upgrade Version'])
ret.append('.metadata.pubdate')
ret_label.append('公開日' if
permissions['current_language']() == 'ja' else 'PubDate')
@@ -3116,6 +3205,18 @@ def get_subs_item(self,
[''] * (max_feedback_mail - len(feedback_mail_list))
)
+ request_mail_list = records.attr_data['request_mail_list'] \
+ .get(recid, [])
+ records.attr_output[recid].extend(request_mail_list)
+ records.attr_output[recid].extend(
+ [''] * (max_request_mail - len(request_mail_list))
+ )
+
+ item_application = records.attr_data['item_application'].get(recid, {})
+ records.attr_output[recid].append(item_application.get('workflow',''))
+ records.attr_output[recid].append(item_application.get('terms',''))
+ records.attr_output[recid].append(item_application.get('termsDescription',''))
+
pid_cnri = record.pid_cnri
cnri = ''
if pid_cnri:
@@ -3207,7 +3308,7 @@ def get_subs_item(self,
ret_system = []
ret_option = []
multiple_option = ['.metadata.path', '.pos_index',
- '.feedback_mail', '.file_path', '.thumbnail_path']
+ '.feedback_mail', '.request_mail', '.file_path', '.thumbnail_path']
meta_list = item_type.get('meta_list', {})
meta_list.update(item_type.get('meta_fix', {}))
form = item_type.get('table_row_map', {}).get('form', {})
diff --git a/modules/weko-items-ui/weko_items_ui/views.py b/modules/weko-items-ui/weko_items_ui/views.py
index 0b2e69d6c4..74fa6bb69e 100644
--- a/modules/weko-items-ui/weko_items_ui/views.py
+++ b/modules/weko-items-ui/weko_items_ui/views.py
@@ -64,7 +64,7 @@
export_items, get_current_user, get_data_authors_prefix_settings, \
get_data_authors_affiliation_settings, \
get_list_email, get_list_username, get_ranking, get_user_info_by_email, \
- get_user_info_by_username, get_user_information, get_user_permission, \
+ get_user_info_by_username, get_user_information, \
get_workflow_by_item_type_id, hide_form_items, is_schema_include_key, \
remove_excluded_items_in_json_schema, sanitize_input_data, save_title, \
set_multi_language_name, to_files_js, translate_schema_form, \
@@ -230,10 +230,17 @@ def iframe_save_model():
for key in metainfo.keys():
if key.startswith('either_valid_'):
del data['metainfo'][key]
-
- activity_session = session['activity_info']
- activity_id = activity_session.get('activity_id', None)
- if activity_id:
+ # double check
+ for key, item in data.get('metainfo').items():
+ if type(item) == list:
+ for setting_vals in item:
+ if type(setting_vals) is dict:
+ for setting_key in setting_vals:
+ if setting_key == 'roles' or setting_key == 'provide':
+ setting_vals[setting_key] = [dict(s) for s in set(frozenset(d.items()) for d in setting_vals[setting_key])]
+
+ if data and data.get('activity_id'):
+ activity_id = data.get('activity_id')
sanitize_input_data(data)
save_title(activity_id, data)
activity = WorkActivity()
@@ -771,36 +778,117 @@ def validate_user_info():
return jsonify(result)
+@blueprint_api.route('/validate_users_info', methods=['POST'])
+def validate_users_info():
+ """validate_users_info.
-@blueprint_api.route('/get_user_info//',
- methods=['GET'])
-def get_user_info(owner, shared_user_id):
+ Host the api which provide 2 service:
+ Validate users list information: check if users is exist
+
+ request:
+ header: Content type must be json
+ data:
+ 'results': [
+ {
+ 'username' : The username,
+ 'email' : The email,
+ 'owner' : True/False
+ }
+ ]
+ return: response pack:
+ [
+ {
+ 'owner' : True/False,
+ 'info': users information if users is valid,
+ 'validation': 'true' if user is valid, other case return 'false',
+ 'error': return error message, empty if no error occurs
+ }
+ ]
+
+ How to use: Validation: fill both username and email
+ """
+ result = {'results':[]}
+
+ if request.headers['Content-Type'] != 'application/json':
+ """Check header of request"""
+ result['error'] = _('Header Error')
+ return jsonify(result)
+
+ data_list = request.get_json()
+ for data in data_list:
+ info = {
+ 'owner': False,
+ 'info': '',
+ 'validation': False,
+ 'error': ''
+ }
+ username = data.get('username', '')
+ email = data.get('email', '')
+
+ try:
+ info['owner'] = data.get('owner', False)
+ if username != "":
+ if email == "":
+ info['info'] = get_user_info_by_username(username)
+ if not info['info']:
+ raise Exception('Not Found Username')
+ info['validation'] = True
+ else:
+ validate_data = validate_user(username, email)
+ info['info'] = validate_data['results']
+ info['validation'] = validate_data['validation']
+ if validate_data['error'] != "":
+ raise Exception(validate_data['error'])
+ result['results'].append(info)
+
+ if email != "" and username == "":
+ info['info'] = get_user_info_by_email(email)
+ if not info['info']:
+ raise Exception('Not Found Email')
+ info['validation'] = True
+ result['results'].append(info)
+
+ except Exception as e:
+ info['error'] = str(e)
+ result['results'].append(info)
+
+ return jsonify(result)
+
+@blueprint_api.route('/get_user_info/', methods=['GET'])
+def get_user_info(owner):
"""get_user_info.
Get username and password by querying user id
param:
- user_id: The user ID
- return: The result json:
+ user_ids: The user ID list
+ return: The result json list:
+ userid: The userid,
username: The username,
email: The email,
error: null if no error occurs
"""
- result = {
+ result = []
+
+ shared_user_ids = request.args.getlist('shared_user_ids', type=int)
+ shared_user_ids.append(owner)
+ user_infos = get_user_information(shared_user_ids)
+ for user_info in user_infos:
+ info = {
+ 'userid': '',
'username': '',
'email': '',
'owner': False,
'error': ''
- }
- try:
- user_info = get_user_information(shared_user_id)
- result['username'] = user_info['username']
- result['email'] = user_info['email']
- if owner != 0:
- result['owner'] = get_user_permission(owner)
- except Exception as e:
- result['error'] = str(e)
-
+ }
+ info['userid'] = user_info['userid']
+ info['username'] = user_info['username']
+ info['email'] = user_info['email']
+ if owner == user_info['userid']:
+ info['owner'] = True
+
+ result.append(info)
+
return jsonify(result)
@@ -823,6 +911,63 @@ def get_current_login_user_id():
return jsonify(result)
+@blueprint_api.route('/is_login_user_email/', methods=['GET'])
+def is_login_user_email(email):
+ result = {
+ 'is_login_user': False,
+ 'error': '',
+ }
+ # get user_id from delete email
+ user_info = get_user_info_by_email(email)
+ current_user_id = int(get_current_user())
+ if (user_info != None and user_info['user_id'] == current_user_id):
+ message = _("Logged-in user cannot be deleted.")
+ result['error'] = message
+ result['is_login_user'] = True
+
+ return jsonify(result)
+
+@blueprint_api.route('/is_login_user_ids', methods=['GET'])
+def is_login_user_ids():
+ ids = request.args.getlist('ids')
+ result = {
+ 'is_login_user' : False,
+ 'error': ''
+ }
+ #admin user
+ supers = current_app.config['WEKO_PERMISSION_SUPER_ROLE_USER'] + current_app.config['WEKO_PERMISSION_ROLE_COMMUNITY']
+ is_admin = False
+ for role in list(current_user.roles or []):
+ if role.name in supers:
+ is_admin = True
+ if not is_admin:
+ for target_id in ids:
+ if int(target_id) == int(get_current_user()):
+ result['is_login_user'] = True
+ result['error'] = _("Logged-in user cannot be deleted.")
+ break
+ else:
+ result['is_login_user'] = False
+ return jsonify(result)
+
+@blueprint_api.route('/get_userinfo_by_emails', methods=['GET'])
+def get_userinfo_by_emails():
+ emails = request.args.getlist('emails')
+ user_infos = []
+ for email in emails :
+ # Flaskのrequest.args.getでは記号「+」が空白になる為、変換する
+ email = email.replace(' ', '+')
+ user_info = get_user_info_by_email(email)
+ if not user_info or ('error' in user_info):
+ raise ConnectionError("wrong email or Cannot connect to server!")
+
+ user_info['user_id'] = user_info['user_id']
+ user_info['username'] = user_info['username']
+ user_info['email'] = user_info['email']
+ user_infos.append(user_info)
+
+ return jsonify(user_infos)
+
@blueprint_api.route('/prepare_edit_item', methods=['POST'])
@login_required
@@ -844,6 +989,7 @@ def prepare_edit_item():
err_code = current_app.config.get('WEKO_ITEMS_UI_API_RETURN_CODE_ERROR',
-1)
if request.headers['Content-Type'] != 'application/json':
+ print(jsonify(code=err_code, msg=_('Header Error')))
"""Check header of request"""
return jsonify(
code=err_code,
@@ -861,9 +1007,8 @@ def prepare_edit_item():
object_type='rec',
getter=record_class.get_record)
recid, deposit = resolver.resolve(pid_value)
- authenticators = [str(deposit.get('owner')),
- str(deposit.get('weko_shared_id'))]
- user_id = str(get_current_user())
+ authenticators = [int(deposit.get('owner'))] + deposit.get('weko_shared_ids') if deposit.get('weko_shared_ids') is not None else []
+ user_id = int(get_current_user())
activity = WorkActivity()
latest_pid = PIDVersioning(child=recid).last_child
@@ -1168,7 +1313,6 @@ def check_validation_error_msg(activity_id):
@blueprint.route('/', methods=['GET'])
@blueprint.route('/corresponding-activity', methods=['GET'])
@login_required
-@item_permission.require(http_exception=403)
def corresponding_activity_list():
"""Get corresponding usage & output activity list.
diff --git a/modules/weko-itemtypes-ui/requirements.txt b/modules/weko-itemtypes-ui/requirements.txt
index 79055f7bc5..0f5d3010cc 100644
--- a/modules/weko-itemtypes-ui/requirements.txt
+++ b/modules/weko-itemtypes-ui/requirements.txt
@@ -161,7 +161,7 @@ boto3==1.7.84
s3fs==0.1.6
#fpdf==1.7.2
-e git+https://github.com/RCOSDP/pyfpdf.git@fix/nii#egg=fpdf
-Pillow==5.4.1
+Pillow==8.1.2
Sickle==0.6.4
Sphinx==1.8.4
pytest>=4.2.0
diff --git a/modules/weko-itemtypes-ui/tests/data/records/test_items.json b/modules/weko-itemtypes-ui/tests/data/records/test_items.json
index 1356e9cacb..dba0e71c4b 100644
--- a/modules/weko-itemtypes-ui/tests/data/records/test_items.json
+++ b/modules/weko-itemtypes-ui/tests/data/records/test_items.json
@@ -15,7 +15,7 @@
"username": "",
"displayname": ""
},
- "shared_user_id": -1,
+ "shared_user_ids": [],
"item_1617186331708": [
{ "subitem_1551255647225": "ff", "subitem_1551255648112": "ja" }
],
@@ -73,7 +73,7 @@
"username": "",
"displayname": ""
},
- "shared_user_id": -1,
+ "shared_user_ids": [],
"item_1617186331708": [
{ "subitem_1551255647225": "ff", "subitem_1551255648112": "ja" }
],
@@ -98,7 +98,7 @@
"username": "",
"displayname": ""
},
- "shared_user_id": -1,
+ "shared_user_ids": [],
"item_1617186331708": [
{ "subitem_1551255647225": "ff", "subitem_1551255648112": "ja" }
],
@@ -123,7 +123,7 @@
"username": "",
"displayname": ""
},
- "shared_user_id": -1,
+ "shared_user_ids": [],
"item_1617186331708": [
{ "subitem_1551255647225": "ff", "subitem_1551255648112": "ja" }
],
@@ -148,7 +148,7 @@
"username": "",
"displayname": ""
},
- "shared_user_id": -1,
+ "shared_user_ids": [],
"item_1617186331708": [
{ "subitem_1551255647225": "ff", "subitem_1551255648112": "ja" }
],
@@ -173,7 +173,7 @@
"username": "",
"displayname": ""
},
- "shared_user_id": -1,
+ "shared_user_ids": [],
"item_1617186331708": [
{ "subitem_1551255647225": "ff", "subitem_1551255648112": "ja" }
],
diff --git a/modules/weko-itemtypes-ui/tests/data/records/test_records.json b/modules/weko-itemtypes-ui/tests/data/records/test_records.json
index 8ba25245f1..69147d8dc4 100644
--- a/modules/weko-itemtypes-ui/tests/data/records/test_records.json
+++ b/modules/weko-itemtypes-ui/tests/data/records/test_records.json
@@ -25,7 +25,7 @@
"item_type_id": "1",
"publish_date": "2022-08-20",
"publish_status": "0",
- "weko_shared_id": -1,
+ "weko_shared_ids": [],
"item_1617186331708": {
"attribute_name": "Title",
"attribute_value_mlt": [
@@ -115,7 +115,7 @@
"item_type_id": "1",
"publish_date": "2022-08-20",
"publish_status": "0",
- "weko_shared_id": -1,
+ "weko_shared_ids": [],
"item_1617186331708": {
"attribute_name": "Title",
"attribute_value_mlt": [
@@ -163,7 +163,7 @@
"item_type_id": "1",
"publish_date": "2022-08-20",
"publish_status": "0",
- "weko_shared_id": -1,
+ "weko_shared_ids": [],
"item_1617186331708": {
"attribute_name": "Title",
"attribute_value_mlt": [
@@ -216,7 +216,7 @@
"item_type_id": "1",
"publish_date": "2022-08-20",
"publish_status": "0",
- "weko_shared_id": -1,
+ "weko_shared_ids": [],
"item_1617186331708": {
"attribute_name": "Title",
"attribute_value_mlt": [
@@ -264,7 +264,7 @@
"item_type_id": "1",
"publish_date": "2022-08-20",
"publish_status": "0",
- "weko_shared_id": -1,
+ "weko_shared_ids": [],
"item_1617186331708": {
"attribute_name": "Title",
"attribute_value_mlt": [
@@ -303,7 +303,7 @@
"item_type_id": "1",
"publish_date": "2022-08-20",
"publish_status": "0",
- "weko_shared_id": -1,
+ "weko_shared_ids": [],
"item_1617186331708": {
"attribute_name": "Title",
"attribute_value_mlt": [
diff --git a/modules/weko-itemtypes-ui/weko_itemtypes_ui/static/js/weko_itemtypes_ui/jsonschemaeditor.js b/modules/weko-itemtypes-ui/weko_itemtypes_ui/static/js/weko_itemtypes_ui/jsonschemaeditor.js
index b159cd01f4..757e057137 100644
--- a/modules/weko-itemtypes-ui/weko_itemtypes_ui/static/js/weko_itemtypes_ui/jsonschemaeditor.js
+++ b/modules/weko-itemtypes-ui/weko_itemtypes_ui/static/js/weko_itemtypes_ui/jsonschemaeditor.js
@@ -206,7 +206,7 @@
},
export: function _export() {
var arr = [];
- if (this.state.enum.length > 0) {
+ if (this.state.enum.length > 0 && !Array.isArray(this.state.enum)) {
arr = this.state.enum.split('|');
}
return {
@@ -276,7 +276,7 @@
},
export: function _export() {
var arr = [];
- if (this.state.enum.length > 0) {
+ if (this.state.enum.length > 0 && !Array.isArray(this.state.enum)) {
arr = this.state.enum.split('|');
}
return {
@@ -344,7 +344,7 @@
},
export: function _export() {
var arr = [];
- if (this.state.enum.length > 0) {
+ if (this.state.enum.length > 0 && !Array.isArray(this.state.enum)) {
arr = this.state.enum.split('|');
}
return {
diff --git a/modules/weko-logging/requirements.txt b/modules/weko-logging/requirements.txt
index 79055f7bc5..0f5d3010cc 100644
--- a/modules/weko-logging/requirements.txt
+++ b/modules/weko-logging/requirements.txt
@@ -161,7 +161,7 @@ boto3==1.7.84
s3fs==0.1.6
#fpdf==1.7.2
-e git+https://github.com/RCOSDP/pyfpdf.git@fix/nii#egg=fpdf
-Pillow==5.4.1
+Pillow==8.1.2
Sickle==0.6.4
Sphinx==1.8.4
pytest>=4.2.0
diff --git a/modules/weko-plugins/requirements.txt b/modules/weko-plugins/requirements.txt
index 79055f7bc5..0f5d3010cc 100644
--- a/modules/weko-plugins/requirements.txt
+++ b/modules/weko-plugins/requirements.txt
@@ -161,7 +161,7 @@ boto3==1.7.84
s3fs==0.1.6
#fpdf==1.7.2
-e git+https://github.com/RCOSDP/pyfpdf.git@fix/nii#egg=fpdf
-Pillow==5.4.1
+Pillow==8.1.2
Sickle==0.6.4
Sphinx==1.8.4
pytest>=4.2.0
diff --git a/modules/weko-records-ui/requirements.txt b/modules/weko-records-ui/requirements.txt
index 79055f7bc5..187384b50b 100644
--- a/modules/weko-records-ui/requirements.txt
+++ b/modules/weko-records-ui/requirements.txt
@@ -13,6 +13,7 @@ binaryornot==0.4.4
bleach==3.1.0
blinker==1.4
cachelib==0.1
+captcha==0.4
cchardet==2.1.1
celery>=4.4.4
certifi==2017.11.5
@@ -24,6 +25,7 @@ click>=6.7
cookiecutter==1.6.0
counter-robots==2018.6
cryptography==2.1.4
+captcha==0.4
datacite==1.0.1
decorator==4.1.2
dictdiffer==0.7.0
@@ -103,6 +105,7 @@ parso==0.1.0
passlib==1.7.1
pexpect==4.3.0
pickleshare==0.7.4
+Pillow==8.1.2
pluggy>=0.11.0<1.0.0
poyo==0.4.1
prompt-toolkit==1.0.15
@@ -161,7 +164,6 @@ boto3==1.7.84
s3fs==0.1.6
#fpdf==1.7.2
-e git+https://github.com/RCOSDP/pyfpdf.git@fix/nii#egg=fpdf
-Pillow==5.4.1
Sickle==0.6.4
Sphinx==1.8.4
pytest>=4.2.0
diff --git a/modules/weko-records-ui/setup.py b/modules/weko-records-ui/setup.py
index 6ff3cd1f1c..03055856c8 100644
--- a/modules/weko-records-ui/setup.py
+++ b/modules/weko-records-ui/setup.py
@@ -90,6 +90,7 @@
'weko_records_ui = weko_records_ui:WekoRecordsUI',
],
'invenio_base.api_apps': [
+ 'weko_records_ui_rest = weko_records_ui:WekoRecordsREST',
'weko_records_ui_cites_rest = weko_records_ui:WekoRecordsCitesREST',
],
'invenio_admin.views': [
@@ -124,6 +125,9 @@
'invenio_db.models': [
'weko_records_ui = weko_records_ui.models',
],
+ 'invenio_oauth2server.scopes': [
+ 'item_read_scope = weko_records_ui.scopes:item_read_scope',
+ ],
},
extras_require=extras_require,
install_requires=install_requires,
diff --git a/modules/weko-records-ui/tests/conftest.py b/modules/weko-records-ui/tests/conftest.py
index db06bfd88b..6d4fc794d6 100644
--- a/modules/weko-records-ui/tests/conftest.py
+++ b/modules/weko-records-ui/tests/conftest.py
@@ -33,10 +33,11 @@
from collections import OrderedDict
from unittest.mock import patch
from datetime import timedelta
+from invenio_mail import InvenioMail
import pytest
from elasticsearch import Elasticsearch
-from flask import Flask
+from flask import Flask ,request
from flask_babelex import Babel
from flask_login import LoginManager, UserMixin
from flask_menu import Menu
@@ -60,6 +61,9 @@
from invenio_oaiserver import InvenioOAIServer
from invenio_oaiserver.views.server import blueprint as invenio_oaiserver_blueprint
from invenio_oaiserver.models import Identify
+from invenio_oauth2server import InvenioOAuth2Server, InvenioOAuth2ServerREST
+from invenio_oauth2server.models import Client, Token
+from invenio_oauth2server.views import settings_blueprint as oauth2server_settings_blueprint
from invenio_pidrelations import InvenioPIDRelations
from invenio_pidrelations.models import PIDRelation
from invenio_pidrelations.contrib.versioning import PIDVersioning
@@ -71,6 +75,7 @@
from invenio_records_files.models import RecordsBuckets
from invenio_records_rest.utils import PIDConverter
from invenio_records_ui import InvenioRecordsUI
+from invenio_rest import InvenioREST
from invenio_search import InvenioSearch, current_search_client
from invenio_search_ui import InvenioSearchUI
from invenio_stats.config import SEARCH_INDEX_PREFIX as index_prefix
@@ -105,10 +110,13 @@
from weko_items_ui.config import WEKO_ITEMS_UI_MS_MIME_TYPE,WEKO_ITEMS_UI_FILE_SISE_PREVIEW_LIMIT
from weko_records import WekoRecords
from weko_records.api import ItemsMetadata
-from weko_records.models import ItemType, ItemTypeMapping, ItemTypeName, SiteLicenseInfo, FeedbackMailList,SiteLicenseIpAddress
+from weko_records_ui.ext import WekoRecordsREST
+from weko_records.models import ItemType, ItemTypeMapping, ItemTypeName, SiteLicenseInfo, FeedbackMailList,SiteLicenseIpAddress,RequestMailList
from weko_records.utils import get_options_and_order_list
from weko_records_ui.config import WEKO_ADMIN_PDFCOVERPAGE_TEMPLATE,RECORDS_UI_ENDPOINTS,WEKO_RECORDS_UI_SECRET_KEY,WEKO_RECORDS_UI_ONETIME_DOWNLOAD_PATTERN
-from weko_records_ui.models import PDFCoverPageSettings,FileOnetimeDownload, FilePermission
+from weko_records_ui.models import FileSecretDownload, PDFCoverPageSettings,FileOnetimeDownload, FilePermission
+from weko_records_ui.scopes import item_read_scope
+from weko_records_ui.utils import _create_secret_download_url, _generate_secret_download_url
from weko_schema_ui.config import (
WEKO_SCHEMA_DDI_SCHEMA_NAME,
WEKO_SCHEMA_JPCOAR_V1_SCHEMA_NAME,
@@ -150,6 +158,12 @@
FlowDefine,
WorkFlow,
)
+from weko_workflow.config import WEKO_WORKFLOW_DATE_FORMAT
+from weko_workflow.scopes import activity_scope
+from weko_workflow.views import workflow_blueprint as weko_workflow_blueprint
+
+from tests.helpers import fill_oauth2_headers
+
@pytest.yield_fixture()
@@ -263,8 +277,13 @@ def base_app(instance_path):
WEKO_RECORDS_UI_SECRET_KEY=WEKO_RECORDS_UI_SECRET_KEY,
WEKO_RECORDS_UI_ONETIME_DOWNLOAD_PATTERN=WEKO_RECORDS_UI_ONETIME_DOWNLOAD_PATTERN,
WEKO_ADMIN_PDFCOVERPAGE_TEMPLATE=WEKO_ADMIN_PDFCOVERPAGE_TEMPLATE,
+ WEKO_WORKFLOW_DATE_FORMAT = WEKO_WORKFLOW_DATE_FORMAT,
+ WEKO_RECORDS_UI_MAIL_TEMPLATE_SECRET_GENRE_ID = 1,
+ MAIL_SUPPRESS_SEND=True
)
- # with ESTestServer(timeout=30) as server:
+ #with ESTestServer(timeout=30) as server:
+ client = Elasticsearch(['localhost:9200'])
+ InvenioSearch(app_, client=client)
Babel(app_)
InvenioAccounts(app_)
InvenioAccess(app_)
@@ -281,13 +300,16 @@ def base_app(instance_path):
InvenioPreviewer(app_)
InvenioRecords(app_)
InvenioRecordsUI(app_)
- # client = Elasticsearch(['localhost:%s'%server.port])
- # InvenioSearch(app_, client=client)
+
InvenioSearch(app_)
InvenioSearchUI(app_)
InvenioPIDRelations(app_)
InvenioI18N(app_)
InvenioTheme(app_)
+ InvenioREST(app_)
+ InvenioOAuth2Server(app_)
+ InvenioOAuth2ServerREST(app_)
+ InvenioMail(app_)
WekoRecords(app_)
WekoItemsUI(app_)
WekoRecordsUI(app_)
@@ -301,12 +323,15 @@ def base_app(instance_path):
WekoSchemaUI(app_)
#Menu(app_)
app_.register_blueprint(weko_records_ui_blueprint)
+ app_.register_blueprint(weko_workflow_blueprint)
app_.register_blueprint(invenio_files_rest_blueprint) # invenio_files_rest
app_.register_blueprint(invenio_oaiserver_blueprint)
+ app_.register_blueprint(oauth2server_settings_blueprint)
# rest_blueprint = create_blueprint(app_, WEKO_DEPOSIT_REST_ENDPOINTS)
# app_.register_blueprint(rest_blueprint)
WekoDeposit(app_)
WekoDepositREST(app_)
+ WekoRecordsREST(app_)
current_assets = LocalProxy(lambda: app_.extensions["invenio-assets"])
current_assets.collect.collect()
@@ -378,8 +403,8 @@ def users(app, db):
repoadmin = User.query.filter_by(email="repoadmin@test.org").first()
sysadmin = User.query.filter_by(email="sysadmin@test.org").first()
generaluser = User.query.filter_by(email="generaluser@test.org")
- originalroleuser = create_test_user(email="originalroleuser@test.org")
- originalroleuser2 = create_test_user(email="originalroleuser2@test.org")
+ originalroleuser = User.query.filter_by(email="originalroleuser@test.org")
+ originalroleuser2 = User.query.filter_by(email="originalroleuser2@test.org")
role_count = Role.query.filter_by(name="System Administrator").count()
if role_count != 1:
@@ -463,8 +488,9 @@ def users(app, db):
ds.add_role_to_user(originalroleuser, originalrole)
ds.add_role_to_user(originalroleuser2, originalrole)
ds.add_role_to_user(originalroleuser2, repoadmin_role)
+ ds.add_role_to_user(user, general_role)
- return [
+ ret = [
{"email": contributor.email, "id": contributor.id, "obj": contributor},
{"email": repoadmin.email, "id": repoadmin.id, "obj": repoadmin},
{"email": sysadmin.email, "id": sysadmin.id, "obj": sysadmin},
@@ -483,6 +509,12 @@ def users(app, db):
{"email": user.email, "id": user.id, "obj": user},
]
+ db.session.expunge_all()
+
+
+ yield ret
+ #return ret
+
@pytest.fixture()
def indextree(client, users):
@@ -600,10 +632,83 @@ def itemtypes(app, db):
item_type_mapping = ItemTypeMapping(id=1, item_type_id=1, mapping=item_type_mapping)
+ item_type_name_31001 = ItemTypeName(
+ id=31001, name="利用申請", has_site_license=True, is_active=True
+ )
+ item_type_schema_31001 = dict()
+ with open("tests/data/itemtype_schema_31001.json", "r") as f:
+ item_type_schema_31001 = json.load(f)
+
+ item_type_form_31001 = dict()
+ with open("tests/data/itemtype_form_31001.json", "r") as f:
+ item_type_form_31001 = json.load(f)
+
+ item_type_render_31001 = dict()
+ with open("tests/data/itemtype_render_31001.json", "r") as f:
+ item_type_render_31001 = json.load(f)
+
+ item_type_mapping_31001 = dict()
+ with open("tests/data/itemtype_mapping_31001.json", "r") as f:
+ item_type_mapping_31001 = json.load(f)
+
+ item_type_31001 = ItemType(
+ id=31001,
+ name_id=31001,
+ harvesting_type=True,
+ schema=item_type_schema_31001,
+ form=item_type_form_31001,
+ render=item_type_render_31001,
+ tag=1,
+ version_id=1,
+ is_deleted=False,
+ )
+
+ item_type_mapping_31001 = ItemTypeMapping(id=31001, item_type_id=31001, mapping=item_type_mapping_31001)
+
+ item_type_name_31002 = ItemTypeName(
+ id=31002, name="二段階利用申請", has_site_license=True, is_active=True
+ )
+ item_type_schema_31002 = dict()
+ with open("tests/data/itemtype_schema_31002.json", "r") as f:
+ item_type_schema_31002 = json.load(f)
+
+ item_type_form_31002 = dict()
+ with open("tests/data/itemtype_form_31002.json", "r") as f:
+ item_type_form_31002 = json.load(f)
+
+ item_type_render_31002 = dict()
+ with open("tests/data/itemtype_render_31002.json", "r") as f:
+ item_type_render_31002 = json.load(f)
+
+ item_type_mapping_31002 = dict()
+ with open("tests/data/itemtype_mapping_31002.json", "r") as f:
+ item_type_mapping_31002 = json.load(f)
+
+ item_type_31002 = ItemType(
+ id=31002,
+ name_id=31002,
+ harvesting_type=True,
+ schema=item_type_schema_31002,
+ form=item_type_form_31002,
+ render=item_type_render_31002,
+ tag=1,
+ version_id=1,
+ is_deleted=False,
+ )
+
+ item_type_mapping_31002 = ItemTypeMapping(id=31002, item_type_id=31002, mapping=item_type_mapping_31002)
+
+
with db.session.begin_nested():
db.session.add(item_type_name)
db.session.add(item_type)
db.session.add(item_type_mapping)
+ db.session.add(item_type_name_31001)
+ db.session.add(item_type_31001)
+ db.session.add(item_type_mapping_31001)
+ db.session.add(item_type_name_31002)
+ db.session.add(item_type_31002)
+ db.session.add(item_type_mapping_31002)
return {
"item_type_name": item_type_name,
@@ -616,7 +721,40 @@ def itemtypes(app, db):
def oaischema(app, db):
schema_name = "jpcoar_mapping"
form_data = {"name": "jpcoar", "file_name": "jpcoar_scm.xsd", "root_name": "jpcoar"}
- xsd = '{"dc:title": {"type": {"maxOccurs": "unbounded", "minOccurs": 1, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "dcterms:alternative": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:creator": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "jpcoar:nameIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "nameIdentifierScheme", "ref": null, "restriction": {"enumeration": ["e-Rad", "NRID", "ORCID", "ISNI", "VIAF", "AID", "kakenhi", "Ringgold", "GRID"]}}, {"use": "optional", "name": "nameIdentifierURI", "ref": null}]}}, "jpcoar:creatorName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:familyName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:givenName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:creatorAlternative": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:affiliation": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "jpcoar:nameIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "nameIdentifierScheme", "ref": null, "restriction": {"enumeration": ["e-Rad", "NRID", "ORCID", "ISNI", "VIAF", "AID", "kakenhi", "Ringgold", "GRID"]}}, {"use": "optional", "name": "nameIdentifierURI", "ref": null}]}}, "jpcoar:affiliationName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}}}, "jpcoar:contributor": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "contributorType", "ref": null, "restriction": {"enumeration": ["ContactPerson", "DataCollector", "DataCurator", "DataManager", "Distributor", "Editor", "HostingInstitution", "Producer", "ProjectLeader", "ProjectManager", "ProjectMember", "RegistrationAgency", "RegistrationAuthority", "RelatedPerson", "Researcher", "ResearchGroup", "Sponsor", "Supervisor", "WorkPackageLeader", "Other"]}}]}, "jpcoar:nameIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "nameIdentifierScheme", "ref": null, "restriction": {"enumeration": ["e-Rad", "NRID", "ORCID", "ISNI", "VIAF", "AID", "kakenhi", "Ringgold", "GRID"]}}, {"use": "optional", "name": "nameIdentifierURI", "ref": null}]}}, "jpcoar:contributorName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:familyName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:givenName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:contributorAlternative": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:affiliation": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "jpcoar:nameIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "nameIdentifierScheme", "ref": null, "restriction": {"enumeration": ["e-Rad", "NRID", "ORCID", "ISNI", "VIAF", "AID", "kakenhi", "Ringgold", "GRID"]}}, {"use": "optional", "name": "nameIdentifierURI", "ref": null}]}}, "jpcoar:affiliationName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}}}, "dcterms:accessRights": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "required", "name": "rdf:resource", "ref": "rdf:resource"}], "restriction": {"enumeration": ["embargoed access", "metadata only access", "open access", "restricted access"]}}}, "rioxxterms:apc": {"type": {"maxOccurs": 1, "minOccurs": 0, "restriction": {"enumeration": ["Paid", "Partially waived", "Fully waived", "Not charged", "Not required", "Unknown"]}}}, "dc:rights": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "rdf:resource", "ref": "rdf:resource"}, {"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:rightsHolder": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "jpcoar:nameIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "nameIdentifierScheme", "ref": null, "restriction": {"enumeration": ["e-Rad", "NRID", "ORCID", "ISNI", "VIAF", "AID", "kakenhi", "Ringgold", "GRID"]}}, {"use": "optional", "name": "nameIdentifierURI", "ref": null}]}}, "jpcoar:rightsHolderName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}}, "jpcoar:subject": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}, {"use": "optional", "name": "subjectURI", "ref": null}, {"use": "required", "name": "subjectScheme", "ref": null, "restriction": {"enumeration": ["BSH", "DDC", "LCC", "LCSH", "MeSH", "NDC", "NDLC", "NDLSH", "Sci-Val", "UDC", "Other"]}}]}}, "datacite:description": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}, {"use": "required", "name": "descriptionType", "ref": null, "restriction": {"enumeration": ["Abstract", "Methods", "TableOfContents", "TechnicalInfo", "Other"]}}]}}, "dc:publisher": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "datacite:date": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "dateType", "ref": null, "restriction": {"enumeration": ["Accepted", "Available", "Collected", "Copyrighted", "Created", "Issued", "Submitted", "Updated", "Valid"]}}]}}, "dc:language": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "restriction": {"patterns": ["^[a-z]{3}$"]}}}, "dc:type": {"type": {"maxOccurs": 1, "minOccurs": 1, "attributes": [{"use": "required", "name": "rdf:resource", "ref": "rdf:resource"}], "restriction": {"enumeration": ["conference paper", "data paper", "departmental bulletin paper", "editorial", "journal article", "newspaper", "periodical", "review article", "software paper", "article", "book", "book part", "cartographic material", "map", "conference object", "conference proceedings", "conference poster", "dataset", "aggregated data", "clinical trial data", "compiled data", "encoded data", "experimental data", "genomic data", "geospatial data", "laboratory notebook", "measurement and test data", "observational data", "recorded data", "simulation data", "survey data", "interview", "image", "still image", "moving image", "video", "lecture", "patent", "internal report", "report", "research report", "technical report", "policy report", "report part", "working paper", "data management plan", "sound", "thesis", "bachelor thesis", "master thesis", "doctoral thesis", "interactive resource", "learning object", "manuscript", "musical notation", "research proposal", "software", "technical documentation", "workflow", "other"]}}}, "datacite:version": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "oaire:versiontype": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "required", "name": "rdf:resource", "ref": "rdf:resource"}], "restriction": {"enumeration": ["AO", "SMUR", "AM", "P", "VoR", "CVoR", "EVoR", "NA"]}}}, "jpcoar:identifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "identifierType", "ref": null, "restriction": {"enumeration": ["DOI", "HDL", "URI"]}}]}}, "jpcoar:identifierRegistration": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "required", "name": "identifierType", "ref": null, "restriction": {"enumeration": ["JaLC", "Crossref", "DataCite", "PMID"]}}]}}, "jpcoar:relation": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "relationType", "ref": null, "restriction": {"enumeration": ["isVersionOf", "hasVersion", "isPartOf", "hasPart", "isReferencedBy", "references", "isFormatOf", "hasFormat", "isReplacedBy", "replaces", "isRequiredBy", "requires", "isSupplementTo", "isSupplementedBy", "isIdenticalTo", "isDerivedFrom", "isSourceOf"]}}]}, "jpcoar:relatedIdentifier": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "required", "name": "identifierType", "ref": null, "restriction": {"enumeration": ["ARK", "arXiv", "DOI", "HDL", "ICHUSHI", "ISBN", "J-GLOBAL", "Local", "PISSN", "EISSN", "NAID", "PMID", "PURL", "SCOPUS", "URI", "WOS"]}}]}}, "jpcoar:relatedTitle": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}}, "dcterms:temporal": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "datacite:geoLocation": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "datacite:geoLocationPoint": {"type": {"maxOccurs": 1, "minOccurs": 0}, "datacite:pointLongitude": {"type": {"maxOccurs": 1, "minOccurs": 1, "restriction": {"maxInclusive": 180, "minInclusive": -180}}}, "datacite:pointLatitude": {"type": {"maxOccurs": 1, "minOccurs": 1, "restriction": {"maxInclusive": 90, "minInclusive": -90}}}}, "datacite:geoLocationBox": {"type": {"maxOccurs": 1, "minOccurs": 0}, "datacite:westBoundLongitude": {"type": {"maxOccurs": 1, "minOccurs": 1, "restriction": {"maxInclusive": 180, "minInclusive": -180}}}, "datacite:eastBoundLongitude": {"type": {"maxOccurs": 1, "minOccurs": 1, "restriction": {"maxInclusive": 180, "minInclusive": -180}}}, "datacite:southBoundLatitude": {"type": {"maxOccurs": 1, "minOccurs": 1, "restriction": {"maxInclusive": 90, "minInclusive": -90}}}, "datacite:northBoundLatitude": {"type": {"maxOccurs": 1, "minOccurs": 1, "restriction": {"maxInclusive": 90, "minInclusive": -90}}}}, "datacite:geoLocationPlace": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}}}, "jpcoar:fundingReference": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "datacite:funderIdentifier": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "required", "name": "funderIdentifierType", "ref": null, "restriction": {"enumeration": ["Crossref Funder", "GRID", "ISNI", "Other"]}}]}}, "jpcoar:funderName": {"type": {"maxOccurs": "unbounded", "minOccurs": 1, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "datacite:awardNumber": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "optional", "name": "awardURI", "ref": null}]}}, "jpcoar:awardTitle": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}}, "jpcoar:sourceIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "identifierType", "ref": null, "restriction": {"enumeration": ["PISSN", "EISSN", "ISSN", "NCID"]}}]}}, "jpcoar:sourceTitle": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:volume": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:issue": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:numPages": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:pageStart": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:pageEnd": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "dcndl:dissertationNumber": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "dcndl:degreeName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "dcndl:dateGranted": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:degreeGrantor": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "jpcoar:nameIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "nameIdentifierScheme", "ref": null, "restriction": {"enumeration": ["e-Rad", "NRID", "ORCID", "ISNI", "VIAF", "AID", "kakenhi", "Ringgold", "GRID"]}}, {"use": "optional", "name": "nameIdentifierURI", "ref": null}]}}, "jpcoar:degreeGrantorName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}}, "jpcoar:conference": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "jpcoar:conferenceName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:conferenceSequence": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:conferenceSponsor": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:conferenceDate": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "optional", "name": "startMonth", "ref": null, "restriction": {"maxInclusive": 12, "minInclusive": 1, "totalDigits": 2}}, {"use": "optional", "name": "endYear", "ref": null, "restriction": {"maxInclusive": 2200, "minInclusive": 1400, "totalDigits": 4}}, {"use": "optional", "name": "startDay", "ref": null, "restriction": {"maxInclusive": 31, "minInclusive": 1, "totalDigits": 2}}, {"use": "optional", "name": "endDay", "ref": null, "restriction": {"maxInclusive": 31, "minInclusive": 1, "totalDigits": 2}}, {"use": "optional", "name": "endMonth", "ref": null, "restriction": {"maxInclusive": 12, "minInclusive": 1, "totalDigits": 2}}, {"use": "optional", "name": "xml:lang", "ref": "xml:lang"}, {"use": "optional", "name": "startYear", "ref": null, "restriction": {"maxInclusive": 2200, "minInclusive": 1400, "totalDigits": 4}}]}}, "jpcoar:conferenceVenue": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:conferencePlace": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:conferenceCountry": {"type": {"maxOccurs": 1, "minOccurs": 0, "restriction": {"patterns": ["^[A-Z]{3}$"]}}}}, "jpcoar:file": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "jpcoar:URI": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "optional", "name": "label", "ref": null}, {"use": "optional", "name": "objectType", "ref": null, "restriction": {"enumeration": ["abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"]}}]}}, "jpcoar:mimeType": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:extent": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}}, "datacite:date": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "dateType", "ref": null, "restriction": {"enumeration": ["Accepted", "Available", "Collected", "Copyrighted", "Created", "Issued", "Submitted", "Updated", "Valid"]}}]}}, "datacite:version": {"type": {"maxOccurs": 1, "minOccurs": 0}}}, "custom:system_file": {"type": {"minOccurs": 0, "maxOccurs": "unbounded"}, "jpcoar:URI": {"type": {"minOccurs": 0, "maxOccurs": 1, "attributes": [{"name": "objectType", "ref": null, "use": "optional", "restriction": {"enumeration": ["abstract", "summary", "fulltext", "thumbnail", "other"]}}, {"name": "label", "ref": null, "use": "optional"}]}}, "jpcoar:mimeType": {"type": {"minOccurs": 0, "maxOccurs": 1}}, "jpcoar:extent": {"type": {"minOccurs": 0, "maxOccurs": "unbounded"}}, "datacite:date": {"type": {"minOccurs": 1, "maxOccurs": "unbounded", "attributes": [{"name": "dateType", "ref": null, "use": "required", "restriction": {"enumeration": ["Accepted", "Available", "Collected", "Copyrighted", "Created", "Issued", "Submitted", "Updated", "Valid"]}}]}}, "datacite:version": {"type": {"minOccurs": 0, "maxOccurs": 1}}}}'
+ xsd = '{"dc:title": {"type": {"maxOccurs": "unbounded", "minOccurs": 1, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, \
+ "dcterms:alternative": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, \
+ "jpcoar:creator": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, \
+ "jpcoar:nameIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "nameIdentifierScheme", "ref": null, \
+ "restriction": {"enumeration": ["e-Rad", "NRID", "ORCID", "ISNI", "VIAF", "AID", "kakenhi", "Ringgold", "GRID"]}}, {"use": "optional", "name": "nameIdentifierURI", "ref": null}]}}, \
+ "jpcoar:creatorName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, \
+ "jpcoar:familyName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, \
+ "jpcoar:givenName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, \
+ "jpcoar:creatorAlternative": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, \
+ "jpcoar:affiliation": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, \
+ "jpcoar:nameIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "nameIdentifierScheme", "ref": null, "restriction": {"enumeration": ["e-Rad", "NRID", "ORCID", "ISNI", "VIAF", "AID", "kakenhi", "Ringgold", "GRID"]}}, {"use": "optional", "name": "nameIdentifierURI", "ref": null}]}}, \
+ "jpcoar:affiliationName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}}}, \
+ "jpcoar:contributor": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "contributorType", "ref": null, "restriction": {"enumeration": ["ContactPerson", "DataCollector", "DataCurator", "DataManager", "Distributor", "Editor", "HostingInstitution", "Producer", "ProjectLeader", "ProjectManager", "ProjectMember", "RegistrationAgency", "RegistrationAuthority", "RelatedPerson", "Researcher", "ResearchGroup", "Sponsor", "Supervisor", "WorkPackageLeader", "Other"]}}]}, \
+ "jpcoar:nameIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "nameIdentifierScheme", "ref": null, "restriction": {"enumeration": ["e-Rad", "NRID", "ORCID", "ISNI", "VIAF", "AID", "kakenhi", "Ringgold", "GRID"]}}, {"use": "optional", "name": "nameIdentifierURI", "ref": null}]}}, \
+ "jpcoar:contributorName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, \
+ "jpcoar:familyName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, \
+ "jpcoar:givenName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, \
+ "jpcoar:contributorAlternative": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, \
+ "jpcoar:affiliation": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "jpcoar:nameIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "nameIdentifierScheme", "ref": null, "restriction": {"enumeration": ["e-Rad", "NRID", "ORCID", "ISNI", "VIAF", "AID", "kakenhi", "Ringgold", "GRID"]}}, {"use": "optional", "name": "nameIdentifierURI", "ref": null}]}}, \
+ "jpcoar:affiliationName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}}}, \
+ "dcterms:accessRights": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "required", "name": "rdf:resource", "ref": "rdf:resource"}], "restriction": {"enumeration": ["embargoed access", "metadata only access", "open access", "restricted access"]}}}, "rioxxterms:apc": {"type": {"maxOccurs": 1, "minOccurs": 0, "restriction": {"enumeration": ["Paid", "Partially waived", "Fully waived", "Not charged", "Not required", "Unknown"]}}}, \
+ "dc:rights": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "rdf:resource", "ref": "rdf:resource"}, {"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:rightsHolder": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "jpcoar:nameIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "nameIdentifierScheme", "ref": null, "restriction": {"enumeration": ["e-Rad", "NRID", "ORCID", "ISNI", "VIAF", "AID", "kakenhi", "Ringgold", "GRID"]}}, {"use": "optional", "name": "nameIdentifierURI", "ref": null}]}}, "jpcoar:rightsHolderName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}}, \
+ "jpcoar:subject": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}, {"use": "optional", "name": "subjectURI", "ref": null}, {"use": "required", "name": "subjectScheme", "ref": null, "restriction": {"enumeration": ["BSH", "DDC", "LCC", "LCSH", "MeSH", "NDC", "NDLC", "NDLSH", "Sci-Val", "UDC", "Other"]}}]}}, \
+ "datacite:description": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}, {"use": "required", "name": "descriptionType", "ref": null, "restriction": {"enumeration": ["Abstract", "Methods", "TableOfContents", "TechnicalInfo", "Other"]}}]}}, "dc:publisher": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "datacite:date": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "dateType", "ref": null, "restriction": {"enumeration": ["Accepted", "Available", "Collected", "Copyrighted", "Created", "Issued", "Submitted", "Updated", "Valid"]}}]}}, "dc:language": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "restriction": {"patterns": ["^[a-z]{3}$"]}}}, "dc:type": {"type": {"maxOccurs": 1, "minOccurs": 1, "attributes": [{"use": "required", "name": "rdf:resource", "ref": "rdf:resource"}], "restriction": {"enumeration": ["conference paper", "data paper", "departmental bulletin paper", "editorial", "journal article", "newspaper", "periodical", "review article", "software paper", "article", "book", "book part", "cartographic material", "map", "conference object", "conference proceedings", "conference poster", "dataset", "aggregated data", "clinical trial data", "compiled data", "encoded data", "experimental data", "genomic data", "geospatial data", "laboratory notebook", "measurement and test data", "observational data", "recorded data", "simulation data", "survey data", "interview", "image", "still image", "moving image", "video", "lecture", "patent", "internal report", "report", "research report", "technical report", "policy report", "report part", "working paper", "data management plan", "sound", "thesis", "bachelor thesis", "master thesis", "doctoral thesis", "interactive resource", "learning object", "manuscript", "musical notation", "research proposal", "software", "technical documentation", "workflow", "other"]}}}, "datacite:version": {"type": {"maxOccurs": 1, "minOccurs": 0}}, \
+ "oaire:versiontype": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "required", "name": "rdf:resource", "ref": "rdf:resource"}], "restriction": {"enumeration": ["AO", "SMUR", "AM", "P", "VoR", "CVoR", "EVoR", "NA"]}}}, \
+ "jpcoar:identifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "identifierType", "ref": null, "restriction": {"enumeration": ["DOI", "HDL", "URI"]}}]}}, \
+ "jpcoar:identifierRegistration": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "required", "name": "identifierType", "ref": null, "restriction": {"enumeration": ["JaLC", "Crossref", "DataCite", "PMID"]}}]}}, \
+ "jpcoar:relation": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "relationType", "ref": null, "restriction": {"enumeration": ["isVersionOf", "hasVersion", "isPartOf", "hasPart", "isReferencedBy", "references", "isFormatOf", "hasFormat", "isReplacedBy", "replaces", "isRequiredBy", "requires", "isSupplementTo", "isSupplementedBy", "isIdenticalTo", "isDerivedFrom", "isSourceOf"]}}]}, "jpcoar:relatedIdentifier": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "required", "name": "identifierType", "ref": null, "restriction": {"enumeration": ["ARK", "arXiv", "DOI", "HDL", "ICHUSHI", "ISBN", "J-GLOBAL", "Local", "PISSN", "EISSN", "NAID", "PMID", "PURL", "SCOPUS", "URI", "WOS"]}}]}}, \
+ "jpcoar:relatedTitle": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}}, \
+ "dcterms:temporal": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, \
+ "datacite:geoLocation": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "datacite:geoLocationPoint": {"type": {"maxOccurs": 1, "minOccurs": 0}, \
+ "datacite:pointLongitude": {"type": {"maxOccurs": 1, "minOccurs": 1, "restriction": {"maxInclusive": 180, "minInclusive": -180}}}, \
+ "datacite:pointLatitude": {"type": {"maxOccurs": 1, "minOccurs": 1, "restriction": {"maxInclusive": 90, "minInclusive": -90}}}}, \
+ "datacite:geoLocationBox": {"type": {"maxOccurs": 1, "minOccurs": 0}, "datacite:westBoundLongitude": {"type": {"maxOccurs": 1, "minOccurs": 1, "restriction": {"maxInclusive": 180, "minInclusive": -180}}}, "datacite:eastBoundLongitude": {"type": {"maxOccurs": 1, "minOccurs": 1, "restriction": {"maxInclusive": 180, "minInclusive": -180}}}, "datacite:southBoundLatitude": {"type": {"maxOccurs": 1, "minOccurs": 1, "restriction": {"maxInclusive": 90, "minInclusive": -90}}}, "datacite:northBoundLatitude": {"type": {"maxOccurs": 1, "minOccurs": 1, "restriction": {"maxInclusive": 90, "minInclusive": -90}}}}, "datacite:geoLocationPlace": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}}}, "jpcoar:fundingReference": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "datacite:funderIdentifier": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "required", "name": "funderIdentifierType", "ref": null, "restriction": {"enumeration": ["Crossref Funder", "GRID", "ISNI", "Other"]}}]}}, "jpcoar:funderName": {"type": {"maxOccurs": "unbounded", "minOccurs": 1, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "datacite:awardNumber": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "optional", "name": "awardURI", "ref": null}]}}, "jpcoar:awardTitle": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}}, "jpcoar:sourceIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "identifierType", "ref": null, "restriction": {"enumeration": ["PISSN", "EISSN", "ISSN", "NCID"]}}]}}, "jpcoar:sourceTitle": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:volume": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:issue": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:numPages": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:pageStart": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:pageEnd": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "dcndl:dissertationNumber": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "dcndl:degreeName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "dcndl:dateGranted": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:degreeGrantor": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "jpcoar:nameIdentifier": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "nameIdentifierScheme", "ref": null, "restriction": {"enumeration": ["e-Rad", "NRID", "ORCID", "ISNI", "VIAF", "AID", "kakenhi", "Ringgold", "GRID"]}}, {"use": "optional", "name": "nameIdentifierURI", "ref": null}]}}, "jpcoar:degreeGrantorName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}}, "jpcoar:conference": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "jpcoar:conferenceName": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:conferenceSequence": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:conferenceSponsor": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:conferenceDate": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "optional", "name": "startMonth", "ref": null, "restriction": {"maxInclusive": 12, "minInclusive": 1, "totalDigits": 2}}, {"use": "optional", "name": "endYear", "ref": null, "restriction": {"maxInclusive": 2200, "minInclusive": 1400, "totalDigits": 4}}, {"use": "optional", "name": "startDay", "ref": null, "restriction": {"maxInclusive": 31, "minInclusive": 1, "totalDigits": 2}}, {"use": "optional", "name": "endDay", "ref": null, "restriction": {"maxInclusive": 31, "minInclusive": 1, "totalDigits": 2}}, {"use": "optional", "name": "endMonth", "ref": null, "restriction": {"maxInclusive": 12, "minInclusive": 1, "totalDigits": 2}}, {"use": "optional", "name": "xml:lang", "ref": "xml:lang"}, {"use": "optional", "name": "startYear", "ref": null, "restriction": {"maxInclusive": 2200, "minInclusive": 1400, "totalDigits": 4}}]}}, "jpcoar:conferenceVenue": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:conferencePlace": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "optional", "name": "xml:lang", "ref": "xml:lang"}]}}, "jpcoar:conferenceCountry": {"type": {"maxOccurs": 1, "minOccurs": 0, "restriction": {"patterns": ["^[A-Z]{3}$"]}}}}, "jpcoar:file": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}, "jpcoar:URI": {"type": {"maxOccurs": 1, "minOccurs": 0, "attributes": [{"use": "optional", "name": "label", "ref": null}, {"use": "optional", "name": "objectType", "ref": null, "restriction": {"enumeration": ["abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"]}}]}}, "jpcoar:mimeType": {"type": {"maxOccurs": 1, "minOccurs": 0}}, "jpcoar:extent": {"type": {"maxOccurs": "unbounded", "minOccurs": 0}}, "datacite:date": {"type": {"maxOccurs": "unbounded", "minOccurs": 0, "attributes": [{"use": "required", "name": "dateType", "ref": null, "restriction": {"enumeration": ["Accepted", "Available", "Collected", "Copyrighted", "Created", "Issued", "Submitted", "Updated", "Valid"]}}]}}, "datacite:version": {"type": {"maxOccurs": 1, "minOccurs": 0}}}, "custom:system_file": {"type": {"minOccurs": 0, "maxOccurs": "unbounded"}, "jpcoar:URI": {"type": {"minOccurs": 0, "maxOccurs": 1, "attributes": [{"name": "objectType", "ref": null, "use": "optional", "restriction": {"enumeration": ["abstract", "summary", "fulltext", "thumbnail", "other"]}}, {"name": "label", "ref": null, "use": "optional"}]}}, "jpcoar:mimeType": {"type": {"minOccurs": 0, "maxOccurs": 1}}, "jpcoar:extent": {"type": {"minOccurs": 0, "maxOccurs": "unbounded"}}, "datacite:date": {"type": {"minOccurs": 1, "maxOccurs": "unbounded", "attributes": [{"name": "dateType", "ref": null, "use": "required", "restriction": {"enumeration": ["Accepted", "Available", "Collected", "Copyrighted", "Created", "Issued", "Submitted", "Updated", "Valid"]}}]}}, "datacite:version": {"type": {"minOccurs": 0, "maxOccurs": 1}}}}'
namespaces = {
"": "https://github.com/JPCOAR/schema/blob/master/1.0/",
"dc": "http://purl.org/dc/elements/1.1/",
@@ -684,7 +822,8 @@ def records(app, db, esindex, indextree, location, itemtypes, oaischema):
filename = "helloworld.pdf"
mimetype = "application/pdf"
filepath = "tests/data/helloworld.pdf"
- results.append(make_record(db, indexer, i, filepath, filename, mimetype))
+ shared_ids = []
+ results.append(make_record(db, indexer, i, filepath, filename, mimetype, shared_ids))
i = 2
filename = "helloworld.docx"
@@ -692,22 +831,24 @@ def records(app, db, esindex, indextree, location, itemtypes, oaischema):
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
)
filepath = "tests/data/helloworld.docx"
- results.append(make_record(db, indexer, i, filepath, filename, mimetype))
+ shared_ids = [1]
+ results.append(make_record(db, indexer, i, filepath, filename, mimetype, shared_ids))
i = 3
filename = "helloworld.zip"
mimetype = "application/zip"
filepath = "tests/data/helloworld.zip"
- results.append(make_record(db, indexer, i, filepath, filename, mimetype))
+ shared_ids = [1,2]
+ results.append(make_record(db, indexer, i, filepath, filename, mimetype, shared_ids))
return indexer, results
-def make_record(db, indexer, i, filepath, filename, mimetype):
+def make_record(db, indexer, i, filepath, filename, mimetype, shared_ids):
record_data = {
"_oai": {"id": "oai:weko3.example.org:000000{:02d}".format(i), "sets": ["{}".format((i % 2) + 1)]},
"path": ["{}".format((i % 2) + 1)],
- "owner": "1",
+ "owner": 1,
"recid": "{}".format(i),
"title": [
"ja_conference paperITEM00000009(public_open_access_open_access_simple)"
@@ -725,7 +866,7 @@ def make_record(db, indexer, i, filepath, filename, mimetype):
"item_type_id": "1",
"publish_date": "2021-08-06",
"publish_status": "0",
- "weko_shared_id": -1,
+ "weko_shared_ids": shared_ids,
"item_1617186331708": {
"attribute_name": "Title",
"attribute_value_mlt": [
@@ -1250,7 +1391,7 @@ def make_record(db, indexer, i, filepath, filename, mimetype):
"id": "{}".format(i),
"pid": {"type": "recid", "value": "{}".format(i), "revision_id": 0},
"path": ["{}".format((i % 2) + 1)],
- "owner": "1",
+ "owner": 1,
"title": "ja_conference paperITEM00000009(public_open_access_open_access_simple)",
"owners": [1],
"status": "draft",
@@ -1816,231 +1957,2862 @@ def make_record(db, indexer, i, filepath, filename, mimetype):
"obj": obj,
}
-
@pytest.fixture()
-def workflows(app, db, itemtypes, users, records):
- action_datas = dict()
- with open("tests/data/actions.json", "r") as f:
- action_datas = json.load(f)
- actions_db = list()
- with db.session.begin_nested():
- for data in action_datas:
- actions_db.append(Action(**data))
- db.session.add_all(actions_db)
+def records_restricted(app, db, workflows_restricted, records ,users):
+ indexer , results = records
- actionstatus_datas = dict()
- with open("tests/data/action_status.json") as f:
- actionstatus_datas = json.load(f)
- actionstatus_db = list()
- with db.session.begin_nested():
- for data in actionstatus_datas:
- actionstatus_db.append(ActionStatus(**data))
- db.session.add_all(actionstatus_db)
+ # with app.test_request_context():
+ i = len(results) + 1
+ # i = 4
+ filename = "helloworld_open_restricted.pdf"
+ mimetype = "application/pdf"
+ filepath = "tests/data/helloworld.pdf"
+ wf1 :WorkFlow = workflows_restricted.get("workflow_workflow1")
+ wf2 :WorkFlow = workflows_restricted.get("workflow_workflow2")
+ results.append(make_record_restricted(db, indexer, i, filepath, filename, mimetype
+ ,"none_loggin" ,wf2.id))
+ i = i + 1
+ results.append(make_record_restricted(db, indexer, i, filepath, filename, mimetype
+ ,str(users[0]["id"]) #contributer
+ ,wf1.id))
+ i = i + 1
+ roles = [{"role":1},{"role":2}]
+ results.append(make_record_restricted_open_login(db, indexer, i, filepath, filename, mimetype
+ ,str(users[0]["id"])
+ ,wf1.id
+ ,roles))
+ i = i + 1
+ roles = []
+ results.append(make_record_restricted_open_login(db, indexer, i, filepath, filename, mimetype
+ ,str(users[0]["id"])
+ ,wf1.id
+ ,roles))
- flow_id = uuid.uuid4()
- flow_define = FlowDefine(
- flow_id=flow_id, flow_name="Registration Flow", flow_user=1, flow_status="A"
- )
- flow_action1 = FlowAction(
- status="N",
- flow_id=flow_id,
- action_id=1,
- action_version="1.0.0",
- action_order=1,
- action_condition="",
- action_status="A",
- action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
- send_mail_setting={},
- )
- flow_action2 = FlowAction(
- status="N",
- flow_id=flow_id,
- action_id=3,
- action_version="1.0.0",
- action_order=2,
- action_condition="",
- action_status="A",
- action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
- send_mail_setting={},
- )
- flow_action3 = FlowAction(
- status="N",
- flow_id=flow_id,
- action_id=5,
- action_version="1.0.0",
- action_order=3,
- action_condition="",
- action_status="A",
- action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
- send_mail_setting={},
- )
+ return indexer, results
- def_workflow = WorkFlow(
- flows_id=uuid.uuid4(),
- flows_name="test workflow1",
- itemtype_id=1,
- index_tree_id=None,
- flow_id=1,
- is_deleted=False,
- open_restricted=False,
- location_id=None,
- is_gakuninrdm=False,
- )
- data_usage_workflow = WorkFlow(
- flows_id=uuid.uuid4(),
- flows_name="Data Usage Report",
- itemtype_id=1,
- index_tree_id=None,
- flow_id=1,
- is_deleted=False,
- open_restricted=False,
- location_id=None,
- is_gakuninrdm=False,
- )
- def_activity = Activity(
- activity_id="A-00000000-00000",
- workflow_id=1,
- flow_id=flow_define.id,
- action_id=1,
- activity_login_user=1,
- activity_update_user=1,
- activity_start=datetime.strptime(
- "2022/04/14 3:01:53.931", "%Y/%m/%d %H:%M:%S.%f"
- ),
- activity_community_id=3,
- activity_confirm_term_of_use=True,
- title="test",
- shared_user_id=-1,
- extra_info={},
- action_order=6,
- )
- data_usage_activity = Activity(
- item_id=records[1][0]['record'].id,
- activity_id="usage_application_activity_id_dummy1",
- workflow_id=1,
- flow_id=flow_define.id,
- action_id=1,
- activity_login_user=1,
- activity_update_user=1,
- activity_start=datetime.strptime(
- "2022/04/14 3:01:53.931", "%Y/%m/%d %H:%M:%S.%f"
- ),
- activity_community_id=3,
- activity_confirm_term_of_use=True,
- title="Data Usage Report",
- shared_user_id=-1,
- extra_info={
- "related_title": "Data Usage Report",
- "record_id": 1,
- "file_name": records[1][0]["filename"],
- "guest_mail": "guest@nii.co.jp",
- "user_mail": "user@nii.co.jp"
+def make_record_restricted(db, indexer, i, filepath, filename, mimetype ,userId ,workflowId):
+ """ make open_resirected record"""
+ record_data = {
+ "_oai": {"id": "oai:weko3.example.org:000000{:02d}".format(i), "sets": ["{}".format((i % 2) + 1)]},
+ "path": ["{}".format((i % 2) + 1)],
+ "owner": 1,
+ "recid": "{}".format(i),
+ "title": [
+ "ja_conference paperITEM00000009(public_open_access_open_access_simple)"
+ ],
+ "pubdate": {"attribute_name": "PubDate", "attribute_value": "2021-08-06"},
+ "_buckets": {"deposit": "27202db8-aefc-4b85-b5ae-4921ac151ddf"},
+ "_deposit": {
+ "id": "{}".format(i),
+ "pid": {"type": "depid", "value": "{}".format(i), "revision_id": 0},
+ "owners": [1],
+ "status": "published",
},
- action_order=6,
- )
- guest_activity = GuestActivity(
- user_mail="guest@nii.co.jp",
- record_id=1,
- file_name=records[1][0]["filename"],
- activity_id='',
- token='',
- expiration_date=datetime.now()
- )
-
- with db.session.begin_nested():
- db.session.add(flow_define)
- db.session.add(flow_action1)
- db.session.add(flow_action2)
- db.session.add(flow_action3)
- db.session.add(def_workflow)
- db.session.add(data_usage_workflow)
- db.session.add(def_activity)
- db.session.add(data_usage_activity)
- db.session.add(guest_activity)
-
- return {
- "flow_define": flow_define,
- "workflow": def_workflow,
- "data_usage_wf": data_usage_workflow,
- "activity": def_activity,
- "guest_activity": guest_activity,
- "data_usage_activity": data_usage_activity,
- "flow_action1": flow_action1,
- "flow_action2": flow_action2,
- "flow_action3": flow_action3,
- }
-
-
-@pytest.fixture()
-def pdfcoverpagesetting(db):
- with db.session.begin_nested():
- setting = PDFCoverPageSettings("enable", "string", "Weko Univ", "", "center")
- db.session.add(setting)
-
-
-@pytest.fixture()
-def site_license_info(app, db):
- record = SiteLicenseInfo(
- organization_id=1,
- organization_name='test',
- domain_name='domain',
- mail_address='nii@nii.co.jp',
- receive_mail_flag=False)
- with db.session.begin_nested():
- db.session.add(record)
- return record
-
-@pytest.fixture()
-def site_license_ipaddr(app, db,site_license_info):
- record1 = SiteLicenseIpAddress(organization_id=1,organization_no=1,start_ip_address="192.168.0.0",finish_ip_address="192.168.0.255")
- # record2 = SiteLicenseIpAddress(organization_id=1,start_ip_address="192.168.1.0",finish_ip_address="192.168.2.255")
- with db.session.begin_nested():
- db.session.add(record1)
- # db.session.add(record2)
- return record1
-
-@pytest.fixture()
-def db_fileonetimedownload(app, db):
- record = FileOnetimeDownload(
- file_name="helloworld.pdf",
- user_mail="wekosoftware@nii.ac.jp",
- record_id='1',
- download_count=10,
- expiration_date=0)
- with db.session.begin_nested():
- db.session.add(record)
- return record
-
-
-@pytest.fixture()
-def db_file_permission(app, db,users,records):
- indexer, results = records
- recid0 = results[0]["recid"]
- filename0 = results[0]["filename"]
- record0 = FilePermission(
- user_id=1, record_id=recid0.pid_value, file_name=filename0,
- usage_application_activity_id="usage_application_activity_id_dummy1",
- usage_report_activity_id=None, status=1,
- )
- recid1 = results[1]["recid"]
- filename1 = results[1]["filename"]
- record1 = FilePermission(
- user_id=1, record_id=recid1.pid_value, file_name=filename1,
- usage_application_activity_id="usage_application_activity_id_dummy1",
- usage_report_activity_id="usage_report_activity_id_dummy1",status=1,
- )
- recid2 = results[2]["recid"]
- filename2 = results[2]["filename"]
+ "item_title": "ja_conference paperITEM00000009(public_open_access_open_access_simple)",
+ "author_link": ["4"],
+ "item_type_id": "1",
+ "publish_date": "2021-08-06",
+ "publish_status": "0",
+ "weko_shared_ids": [],
+ "item_1617186331708": {
+ "attribute_name": "Title",
+ "attribute_value_mlt": [
+ {
+ "subitem_1551255647225": "ja_conference paperITEM00000009(public_open_access_open_access_simple)",
+ "subitem_1551255648112": "ja",
+ },
+ {
+ "subitem_1551255647225": "en_conference paperITEM00000009(public_open_access_simple)",
+ "subitem_1551255648112": "en",
+ },
+ ],
+ },
+ "item_1617186385884": {
+ "attribute_name": "Alternative Title",
+ "attribute_value_mlt": [
+ {
+ "subitem_1551255720400": "Alternative Title",
+ "subitem_1551255721061": "en",
+ },
+ {
+ "subitem_1551255720400": "Alternative Title",
+ "subitem_1551255721061": "ja",
+ },
+ ],
+ },
+ "item_1617186419668": {
+ "attribute_name": "Creator",
+ "attribute_type": "creator",
+ "attribute_value_mlt": [
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "creatorMails": [{"creatorMail": "wekosoftware@nii.ac.jp"}],
+ "creatorNames": [
+ {"creatorName": "情報, 太郎", "creatorNameLang": "ja"},
+ {"creatorName": "ジョウホウ, タロウ", "creatorNameLang": "ja-Kana"},
+ {"creatorName": "Joho, Taro", "creatorNameLang": "en"},
+ ],
+ "nameIdentifiers": [
+ {"nameIdentifier": "4", "nameIdentifierScheme": "WEKO"},
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "zzzzzzz",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ "creatorAffiliations": [
+ {
+ "affiliationNames": [
+ {
+ "affiliationName": "University",
+ "affiliationNameLang": "en",
+ }
+ ],
+ "affiliationNameIdentifiers": [
+ {
+ "affiliationNameIdentifier": "0000000121691048",
+ "affiliationNameIdentifierURI": "http://isni.org/isni/0000000121691048",
+ "affiliationNameIdentifierScheme": "ISNI",
+ }
+ ],
+ }
+ ],
+ },
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "creatorMails": [{"creatorMail": "wekosoftware@nii.ac.jp"}],
+ "creatorNames": [
+ {"creatorName": "情報, 太郎", "creatorNameLang": "ja"},
+ {"creatorName": "ジョウホウ, タロウ", "creatorNameLang": "ja-Kana"},
+ {"creatorName": "Joho, Taro", "creatorNameLang": "en"},
+ ],
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "zzzzzzz",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ },
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "creatorMails": [{"creatorMail": "wekosoftware@nii.ac.jp"}],
+ "creatorNames": [
+ {"creatorName": "情報, 太郎", "creatorNameLang": "ja"},
+ {"creatorName": "ジョウホウ, タロウ", "creatorNameLang": "ja-Kana"},
+ {"creatorName": "Joho, Taro", "creatorNameLang": "en"},
+ ],
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "zzzzzzz",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ },
+ ],
+ },
+ "item_1617186476635": {
+ "attribute_name": "Access Rights",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522299639480": "open access",
+ "subitem_1600958577026": "http://purl.org/coar/access_right/c_abf2",
+ }
+ ],
+ },
+ "item_1617186499011": {
+ "attribute_name": "Rights",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522650717957": "ja",
+ "subitem_1522650727486": "http://localhost",
+ "subitem_1522651041219": "Rights Information",
+ }
+ ],
+ },
+ "item_1617186609386": {
+ "attribute_name": "Subject",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522299896455": "ja",
+ "subitem_1522300014469": "Other",
+ "subitem_1522300048512": "http://localhost/",
+ "subitem_1523261968819": "Sibject1",
+ }
+ ],
+ },
+ "item_1617186626617": {
+ "attribute_name": "Description",
+ "attribute_value_mlt": [
+ {
+ "subitem_description": "Description\nDescription Description",
+ "subitem_description_type": "Abstract",
+ "subitem_description_language": "en",
+ },
+ {
+ "subitem_description": "概要\n概要\n概要\n概要",
+ "subitem_description_type": "Abstract",
+ "subitem_description_language": "ja",
+ },
+ ],
+ },
+ "item_1617186643794": {
+ "attribute_name": "Publisher",
+ "attribute_value_mlt": [
+ {"subitem_1522300295150": "en", "subitem_1522300316516": "Publisher"}
+ ],
+ },
+ "item_1617186660861": {
+ "attribute_name": "Date",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522300695726": "Available",
+ "subitem_1522300722591": "2021-06-30",
+ }
+ ],
+ },
+ "item_1617186702042": {
+ "attribute_name": "Language",
+ "attribute_value_mlt": [{"subitem_1551255818386": "jpn"}],
+ },
+ "item_1617186783814": {
+ "attribute_name": "Identifier",
+ "attribute_value_mlt": [
+ {
+ "subitem_identifier_uri": "http://localhost",
+ "subitem_identifier_type": "URI",
+ }
+ ],
+ },
+ "item_1617186859717": {
+ "attribute_name": "Temporal",
+ "attribute_value_mlt": [
+ {"subitem_1522658018441": "en", "subitem_1522658031721": "Temporal"}
+ ],
+ },
+ "item_1617186882738": {
+ "attribute_name": "Geo Location",
+ "attribute_value_mlt": [
+ {
+ "subitem_geolocation_place": [
+ {"subitem_geolocation_place_text": "Japan"}
+ ]
+ }
+ ],
+ },
+ "item_1617186901218": {
+ "attribute_name": "Funding Reference",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522399143519": {
+ "subitem_1522399281603": "ISNI",
+ "subitem_1522399333375": "http://xxx",
+ },
+ "subitem_1522399412622": [
+ {
+ "subitem_1522399416691": "en",
+ "subitem_1522737543681": "Funder Name",
+ }
+ ],
+ "subitem_1522399571623": {
+ "subitem_1522399585738": "Award URI",
+ "subitem_1522399628911": "Award Number",
+ },
+ "subitem_1522399651758": [
+ {
+ "subitem_1522721910626": "en",
+ "subitem_1522721929892": "Award Title",
+ }
+ ],
+ }
+ ],
+ },
+ "item_1617186920753": {
+ "attribute_name": "Source Identifier",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522646500366": "ISSN",
+ "subitem_1522646572813": "xxxx-xxxx-xxxx",
+ }
+ ],
+ },
+ "item_1617186941041": {
+ "attribute_name": "Source Title",
+ "attribute_value_mlt": [
+ {"subitem_1522650068558": "en", "subitem_1522650091861": "Source Title"}
+ ],
+ },
+ "item_1617186959569": {
+ "attribute_name": "Volume Number",
+ "attribute_value_mlt": [{"subitem_1551256328147": "1"}],
+ },
+ "item_1617186981471": {
+ "attribute_name": "Issue Number",
+ "attribute_value_mlt": [{"subitem_1551256294723": "111"}],
+ },
+ "item_1617186994930": {
+ "attribute_name": "Number of Pages",
+ "attribute_value_mlt": [{"subitem_1551256248092": "12"}],
+ },
+ "item_1617187024783": {
+ "attribute_name": "Page Start",
+ "attribute_value_mlt": [{"subitem_1551256198917": "1"}],
+ },
+ "item_1617187045071": {
+ "attribute_name": "Page End",
+ "attribute_value_mlt": [{"subitem_1551256185532": "3"}],
+ },
+ "item_1617187112279": {
+ "attribute_name": "Degree Name",
+ "attribute_value_mlt": [
+ {"subitem_1551256126428": "Degree Name", "subitem_1551256129013": "en"}
+ ],
+ },
+ "item_1617187136212": {
+ "attribute_name": "Date Granted",
+ "attribute_value_mlt": [{"subitem_1551256096004": "2021-06-30"}],
+ },
+ "item_1617187187528": {
+ "attribute_name": "Conference",
+ "attribute_value_mlt": [
+ {
+ "subitem_1599711633003": [
+ {
+ "subitem_1599711636923": "Conference Name",
+ "subitem_1599711645590": "ja",
+ }
+ ],
+ "subitem_1599711655652": "1",
+ "subitem_1599711660052": [
+ {
+ "subitem_1599711680082": "Sponsor",
+ "subitem_1599711686511": "ja",
+ }
+ ],
+ "subitem_1599711699392": {
+ "subitem_1599711704251": "2020/12/11",
+ "subitem_1599711712451": "1",
+ "subitem_1599711727603": "12",
+ "subitem_1599711731891": "2000",
+ "subitem_1599711735410": "1",
+ "subitem_1599711739022": "12",
+ "subitem_1599711743722": "2020",
+ "subitem_1599711745532": "ja",
+ },
+ "subitem_1599711758470": [
+ {
+ "subitem_1599711769260": "Conference Venue",
+ "subitem_1599711775943": "ja",
+ }
+ ],
+ "subitem_1599711788485": [
+ {
+ "subitem_1599711798761": "Conference Place",
+ "subitem_1599711803382": "ja",
+ }
+ ],
+ "subitem_1599711813532": "JPN",
+ }
+ ],
+ },
+ "item_1617258105262": {
+ "attribute_name": "Resource Type",
+ "attribute_value_mlt": [
+ {
+ "resourceuri": "http://purl.org/coar/resource_type/c_5794",
+ "resourcetype": "conference paper",
+ }
+ ],
+ },
+ "item_1617265215918": {
+ "attribute_name": "Version Type",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522305645492": "AO",
+ "subitem_1600292170262": "http://purl.org/coar/version/c_b1a7d7d4d402bcce",
+ }
+ ],
+ },
+ "item_1617349709064": {
+ "attribute_name": "Contributor",
+ "attribute_value_mlt": [
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "contributorType": "ContactPerson",
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ "contributorMails": [{"contributorMail": "wekosoftware@nii.ac.jp"}],
+ "contributorNames": [
+ {"lang": "ja", "contributorName": "情報, 太郎"},
+ {"lang": "ja-Kana", "contributorName": "ジョウホウ, タロウ"},
+ {"lang": "en", "contributorName": "Joho, Taro"},
+ ],
+ }
+ ],
+ },
+ "item_1617349808926": {
+ "attribute_name": "Version",
+ "attribute_value_mlt": [{"subitem_1523263171732": "Version"}],
+ },
+ "item_1617351524846": {
+ "attribute_name": "APC",
+ "attribute_value_mlt": [{"subitem_1523260933860": "Unknown"}],
+ },
+ "item_1617353299429": {
+ "attribute_name": "Relation",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522306207484": "isVersionOf",
+ "subitem_1522306287251": {
+ "subitem_1522306382014": "arXiv",
+ "subitem_1522306436033": "xxxxx",
+ },
+ "subitem_1523320863692": [
+ {
+ "subitem_1523320867455": "en",
+ "subitem_1523320909613": "Related Title",
+ }
+ ],
+ }
+ ],
+ },
+ "item_1617605131499": {
+ "attribute_name": "File",
+ "attribute_type": "file",
+ "attribute_value_mlt": [
+ {
+ "url": {"url": "https://weko3.example.org/record/{0}/files/{1}".format(
+ i, filename
+ )},
+ "date": [{"dateType": "Available", "dateValue": "2021-07-12"}],
+ "format": "text/plain",
+ "filename": "{}".format(filename),
+ "filesize": [{"value": "1 KB"}],
+ "mimetype": "{}".format(mimetype),
+ "accessrole": "open_restricted",
+ "version_id": "c1502853-c2f9-455d-8bec-f6e630e54b21",
+ "displaytype": "simple",
+ "terms": 'term_free',# if i==4 else '100',
+ "terms_content": 'test terms_content' if i==4 else 'test2 terms context',
+ }
+ ],
+ },
+ "item_1617610673286": {
+ "attribute_name": "Rights Holder",
+ "attribute_value_mlt": [
+ {
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ }
+ ],
+ "rightHolderNames": [
+ {
+ "rightHolderName": "Right Holder Name",
+ "rightHolderLanguage": "ja",
+ }
+ ],
+ }
+ ],
+ },
+ "item_1617620223087": {
+ "attribute_name": "Heading",
+ "attribute_value_mlt": [
+ {
+ "subitem_1565671149650": "ja",
+ "subitem_1565671169640": "Banner Headline",
+ "subitem_1565671178623": "Subheading",
+ },
+ {
+ "subitem_1565671149650": "en",
+ "subitem_1565671169640": "Banner Headline",
+ "subitem_1565671178623": "Subheding",
+ },
+ ],
+ },
+ "item_1617944105607": {
+ "attribute_name": "Degree Grantor",
+ "attribute_value_mlt": [
+ {
+ "subitem_1551256015892": [
+ {
+ "subitem_1551256027296": "xxxxxx",
+ "subitem_1551256029891": "kakenhi",
+ }
+ ],
+ "subitem_1551256037922": [
+ {
+ "subitem_1551256042287": "Degree Grantor Name",
+ "subitem_1551256047619": "en",
+ }
+ ],
+ }
+ ],
+ },
+ "relation_version_is_last": True,
+ }
+
+ item_data = {
+ "id": "{}".format(i),
+ "pid": {"type": "recid", "value": "{}".format(i), "revision_id": 0},
+ "path": ["{}".format((i % 2) + 1)],
+ "owner": 1,
+ "title": "ja_conference paperITEM00000009(public_open_access_open_access_simple)",
+ "owners": [1],
+ "status": "draft",
+ "$schema": "https://localhost:8443/items/jsonschema/1",
+ "pubdate": "2021-08-06",
+ "feedback_mail_list": [{"email": "wekosoftware@nii.ac.jp", "author_id": ""}],
+ "item_1617186331708": [
+ {
+ "subitem_1551255647225": "ja_conference paperITEM00000009(public_open_access_open_access_simple)",
+ "subitem_1551255648112": "ja",
+ },
+ {
+ "subitem_1551255647225": "en_conference paperITEM00000009(public_open_access_simple)",
+ "subitem_1551255648112": "en",
+ },
+ ],
+ "item_1617186385884": [
+ {
+ "subitem_1551255720400": "Alternative Title",
+ "subitem_1551255721061": "en",
+ },
+ {
+ "subitem_1551255720400": "Alternative Title",
+ "subitem_1551255721061": "ja",
+ },
+ ],
+ "item_1617186419668": [
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "creatorMails": [{"creatorMail": "wekosoftware@nii.ac.jp"}],
+ "creatorNames": [
+ {"creatorName": "情報, 太郎", "creatorNameLang": "ja"},
+ {"creatorName": "ジョウホウ, タロウ", "creatorNameLang": "ja-Kana"},
+ {"creatorName": "Joho, Taro", "creatorNameLang": "en"},
+ ],
+ "nameIdentifiers": [
+ {"nameIdentifier": "4", "nameIdentifierScheme": "WEKO"},
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "zzzzzzz",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ "creatorAffiliations": [
+ {
+ "affiliationNames": [
+ {
+ "affiliationName": "University",
+ "affiliationNameLang": "en",
+ }
+ ],
+ "affiliationNameIdentifiers": [
+ {
+ "affiliationNameIdentifier": "0000000121691048",
+ "affiliationNameIdentifierURI": "http://isni.org/isni/0000000121691048",
+ "affiliationNameIdentifierScheme": "ISNI",
+ }
+ ],
+ }
+ ],
+ },
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "creatorMails": [{"creatorMail": "wekosoftware@nii.ac.jp"}],
+ "creatorNames": [
+ {"creatorName": "情報, 太郎", "creatorNameLang": "ja"},
+ {"creatorName": "ジョウホウ, タロウ", "creatorNameLang": "ja-Kana"},
+ {"creatorName": "Joho, Taro", "creatorNameLang": "en"},
+ ],
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "zzzzzzz",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ },
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "creatorMails": [{"creatorMail": "wekosoftware@nii.ac.jp"}],
+ "creatorNames": [
+ {"creatorName": "情報, 太郎", "creatorNameLang": "ja"},
+ {"creatorName": "ジョウホウ, タロウ", "creatorNameLang": "ja-Kana"},
+ {"creatorName": "Joho, Taro", "creatorNameLang": "en"},
+ ],
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "zzzzzzz",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ },
+ ],
+ "item_1617186476635": {
+ "subitem_1522299639480": "open access",
+ "subitem_1600958577026": "http://purl.org/coar/access_right/c_abf2",
+ },
+ "item_1617186499011": [
+ {
+ "subitem_1522650717957": "ja",
+ "subitem_1522650727486": "http://localhost",
+ "subitem_1522651041219": "Rights Information",
+ }
+ ],
+ "item_1617186609386": [
+ {
+ "subitem_1522299896455": "ja",
+ "subitem_1522300014469": "Other",
+ "subitem_1522300048512": "http://localhost/",
+ "subitem_1523261968819": "Sibject1",
+ }
+ ],
+ "item_1617186626617": [
+ {
+ "subitem_description": "Description\nDescription Description",
+ "subitem_description_type": "Abstract",
+ "subitem_description_language": "en",
+ },
+ {
+ "subitem_description": "概要\n概要\n概要\n概要",
+ "subitem_description_type": "Abstract",
+ "subitem_description_language": "ja",
+ },
+ ],
+ "item_1617186643794": [
+ {"subitem_1522300295150": "en", "subitem_1522300316516": "Publisher"}
+ ],
+ "item_1617186660861": [
+ {
+ "subitem_1522300695726": "Available",
+ "subitem_1522300722591": "2021-06-30",
+ }
+ ],
+ "item_1617186702042": [{"subitem_1551255818386": "jpn"}],
+ "item_1617186783814": [
+ {
+ "subitem_identifier_uri": "http://localhost",
+ "subitem_identifier_type": "URI",
+ }
+ ],
+ "item_1617186859717": [
+ {"subitem_1522658018441": "en", "subitem_1522658031721": "Temporal"}
+ ],
+ "item_1617186882738": [
+ {"subitem_geolocation_place": [{"subitem_geolocation_place_text": "Japan"}]}
+ ],
+ "item_1617186901218": [
+ {
+ "subitem_1522399143519": {
+ "subitem_1522399281603": "ISNI",
+ "subitem_1522399333375": "http://xxx",
+ },
+ "subitem_1522399412622": [
+ {
+ "subitem_1522399416691": "en",
+ "subitem_1522737543681": "Funder Name",
+ }
+ ],
+ "subitem_1522399571623": {
+ "subitem_1522399585738": "Award URI",
+ "subitem_1522399628911": "Award Number",
+ },
+ "subitem_1522399651758": [
+ {
+ "subitem_1522721910626": "en",
+ "subitem_1522721929892": "Award Title",
+ }
+ ],
+ }
+ ],
+ "item_1617186920753": [
+ {"subitem_1522646500366": "ISSN", "subitem_1522646572813": "xxxx-xxxx-xxxx"}
+ ],
+ "item_1617186941041": [
+ {"subitem_1522650068558": "en", "subitem_1522650091861": "Source Title"}
+ ],
+ "item_1617186959569": {"subitem_1551256328147": "1"},
+ "item_1617186981471": {"subitem_1551256294723": "111"},
+ "item_1617186994930": {"subitem_1551256248092": "12"},
+ "item_1617187024783": {"subitem_1551256198917": "1"},
+ "item_1617187045071": {"subitem_1551256185532": "3"},
+ "item_1617187112279": [
+ {"subitem_1551256126428": "Degree Name", "subitem_1551256129013": "en"}
+ ],
+ "item_1617187136212": {"subitem_1551256096004": "2021-06-30"},
+ "item_1617187187528": [
+ {
+ "subitem_1599711633003": [
+ {
+ "subitem_1599711636923": "Conference Name",
+ "subitem_1599711645590": "ja",
+ }
+ ],
+ "subitem_1599711655652": "1",
+ "subitem_1599711660052": [
+ {"subitem_1599711680082": "Sponsor", "subitem_1599711686511": "ja"}
+ ],
+ "subitem_1599711699392": {
+ "subitem_1599711704251": "2020/12/11",
+ "subitem_1599711712451": "1",
+ "subitem_1599711727603": "12",
+ "subitem_1599711731891": "2000",
+ "subitem_1599711735410": "1",
+ "subitem_1599711739022": "12",
+ "subitem_1599711743722": "2020",
+ "subitem_1599711745532": "ja",
+ },
+ "subitem_1599711758470": [
+ {
+ "subitem_1599711769260": "Conference Venue",
+ "subitem_1599711775943": "ja",
+ }
+ ],
+ "subitem_1599711788485": [
+ {
+ "subitem_1599711798761": "Conference Place",
+ "subitem_1599711803382": "ja",
+ }
+ ],
+ "subitem_1599711813532": "JPN",
+ }
+ ],
+ "item_1617258105262": {
+ "resourceuri": "http://purl.org/coar/resource_type/c_5794",
+ "resourcetype": "conference paper",
+ },
+ "item_1617265215918": {
+ "subitem_1522305645492": "AO",
+ "subitem_1600292170262": "http://purl.org/coar/version/c_b1a7d7d4d402bcce",
+ },
+ "item_1617349709064": [
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "contributorType": "ContactPerson",
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ "contributorMails": [{"contributorMail": "wekosoftware@nii.ac.jp"}],
+ "contributorNames": [
+ {"lang": "ja", "contributorName": "情報, 太郎"},
+ {"lang": "ja-Kana", "contributorName": "ジョウホ, タロウ"},
+ {"lang": "en", "contributorName": "Joho, Taro"},
+ ],
+ }
+ ],
+ "item_1617349808926": {"subitem_1523263171732": "Version"},
+ "item_1617351524846": {"subitem_1523260933860": "Unknown"},
+ "item_1617353299429": [
+ {
+ "subitem_1522306207484": "isVersionOf",
+ "subitem_1522306287251": {
+ "subitem_1522306382014": "arXiv",
+ "subitem_1522306436033": "xxxxx",
+ },
+ "subitem_1523320863692": [
+ {
+ "subitem_1523320867455": "en",
+ "subitem_1523320909613": "Related Title",
+ }
+ ],
+ }
+ ],
+ "item_1617605131499": [
+ {
+ "url": {
+ "url": "https://weko3.example.org/record/{0}/files/{1}".format(i,filename)
+ },
+ "date": [{"dateType": "Available", "dateValue": "2021-07-12"}],
+ "format": "{}".format(mimetype),
+ "filename": "{}".format(filename),
+ "filesize": [{"value": "1 KB"}],
+ "mimetype": "{}".format(mimetype),
+ "accessrole": "open_restricted",
+ "version_id": "c1502853-c2f9-455d-8bec-f6e630e54b21",
+ "displaytype": "simple",
+ "terms": 'term_free', #if i==4 else '100',
+ "terms_content": 'test terms_content' if i==4 else 'test2 terms context',
+ }
+ ],
+ "item_1617610673286": [
+ {
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ }
+ ],
+ "rightHolderNames": [
+ {
+ "rightHolderName": "Right Holder Name",
+ "rightHolderLanguage": "ja",
+ }
+ ],
+ }
+ ],
+ "item_1617620223087": [
+ {
+ "subitem_1565671149650": "ja",
+ "subitem_1565671169640": "Banner Headline",
+ "subitem_1565671178623": "Subheading",
+ },
+ {
+ "subitem_1565671149650": "en",
+ "subitem_1565671169640": "Banner Headline",
+ "subitem_1565671178623": "Subheding",
+ },
+ ],
+ "item_1617944105607": [
+ {
+ "subitem_1551256015892": [
+ {
+ "subitem_1551256027296": "xxxxxx",
+ "subitem_1551256029891": "kakenhi",
+ }
+ ],
+ "subitem_1551256037922": [
+ {
+ "subitem_1551256042287": "Degree Grantor Name",
+ "subitem_1551256047619": "en",
+ }
+ ],
+ }
+ ],
+ }
+
+ rec_uuid = uuid.uuid4()
+
+ recid = PersistentIdentifier.create(
+ "recid",
+ str(i),
+ object_type="rec",
+ object_uuid=rec_uuid,
+ status=PIDStatus.REGISTERED,
+ )
+ depid = PersistentIdentifier.create(
+ "depid",
+ str(i),
+ object_type="rec",
+ object_uuid=rec_uuid,
+ status=PIDStatus.REGISTERED,
+ )
+ parent = None
+ doi = None
+ hdl = None
+ recid_v1 = PersistentIdentifier.create(
+ "recid",
+ str(i + 0.1),
+ object_type="rec",
+ object_uuid=rec_uuid,
+ status=PIDStatus.REGISTERED,
+ )
+ rec_uuid2 = uuid.uuid4()
+ depid_v1 = PersistentIdentifier.create(
+ "depid",
+ str(i + 0.1),
+ object_type="rec",
+ object_uuid=rec_uuid2,
+ status=PIDStatus.REGISTERED,
+ )
+ parent = PersistentIdentifier.create(
+ "parent",
+ "parent:{}".format(i),
+ object_type="rec",
+ object_uuid=rec_uuid2,
+ status=PIDStatus.REGISTERED,
+ )
+
+ h1 = PIDVersioning(parent=parent)
+ h1.insert_child(child=recid)
+ h1.insert_child(child=recid_v1)
+ RecordDraft.link(recid, depid)
+ RecordDraft.link(recid_v1, depid_v1)
+
+ if i % 2 == 1:
+ doi = PersistentIdentifier.create(
+ "doi",
+ "https://doi.org/10.xyz/{}".format((str(i)).zfill(10)),
+ object_type="rec",
+ object_uuid=rec_uuid,
+ status=PIDStatus.REGISTERED,
+ )
+ hdl = PersistentIdentifier.create(
+ "hdl",
+ "https://hdl.handle.net/0000/{}".format((str(i)).zfill(10)),
+ object_type="rec",
+ object_uuid=rec_uuid,
+ status=PIDStatus.REGISTERED,
+ )
+
+ record = WekoRecord.create(record_data, id_=rec_uuid)
+ # from six import BytesIO
+ import base64
+
+ bucket = Bucket.create()
+ record_buckets = RecordsBuckets.create(record=record.model, bucket=bucket)
+
+ # stream = BytesIO(b"Hello, World")
+ obj = None
+ with open(filepath, "rb") as f:
+ stream = BytesIO(f.read())
+ record.files[filename] = stream
+ record["item_1617605131499"]["attribute_value_mlt"][0]["file"] = (
+ base64.b64encode(stream.getvalue())
+ ).decode("utf-8")
+ with open(filepath, "rb") as f:
+ obj = ObjectVersion.create(bucket=bucket.id, key=filename, stream=f)
+ deposit = aWekoDeposit(record, record.model)
+ deposit.commit()
+ record["item_1617605131499"]["attribute_value_mlt"][0]["version_id"] = str(
+ obj.version_id
+ )
+
+ record_data["content"] = [
+ {
+ "date": [{"dateValue": "2021-07-12", "dateType": "Available"}],
+ "accessrole": "open_restricted",
+ #"provide" : [{"role": userId, "workflow": workflowId }],
+ #"terms" :"term_free","termsDescription":"利用規約本文",
+ "displaytype": "simple",
+ "filename": filename,
+ "attachment": {},
+ "format": mimetype,
+ "mimetype": mimetype,
+ "filesize": [{"value": "1 KB"}],
+ "version_id": "{}".format(obj.version_id),
+ "url": {"url": "http://localhost/record/{0}/files/{1}".format(i, filename)},
+ "file": (base64.b64encode(stream.getvalue())).decode("utf-8"),
+ }
+ ]
+
+ indexer.upload_metadata(record_data, rec_uuid, 1, False)
+ item = ItemsMetadata.create(item_data, id_=rec_uuid, item_type_id=1)
+
+ record_v1 = WekoRecord.create(record_data, id_=rec_uuid2)
+ # from six import BytesIO
+ import base64
+
+ bucket_v1 = Bucket.create()
+ record_buckets = RecordsBuckets.create(record=record_v1.model, bucket=bucket_v1)
+ # stream = BytesIO(b"Hello, World")
+ record_v1.files[filename] = stream
+ obj_v1 = ObjectVersion.create(bucket=bucket_v1.id, key=filename, stream=stream)
+ record_v1["item_1617605131499"]["attribute_value_mlt"][0]["file"] = (
+ base64.b64encode(stream.getvalue())
+ ).decode("utf-8")
+ deposit_v1 = aWekoDeposit(record_v1, record_v1.model)
+ deposit_v1.commit()
+ record_v1["item_1617605131499"]["attribute_value_mlt"][0]["version_id"] = str(
+ obj_v1.version_id
+ )
+
+ record_data_v1 = copy.deepcopy(record_data)
+ record_data_v1["content"] = [
+ {
+ "date": [{"dateValue": "2021-07-12", "dateType": "Available"}],
+ "accessrole": "open_restricted",
+ "provide" : [{"role" :userId, "workflow": workflowId }],
+ "terms" :"term_free","termsDescription":"利用規約本文",
+ "displaytype": "simple",
+ "filename": filename,
+ "attachment": {},
+ "format": mimetype,
+ "mimetype": mimetype,
+ "filesize": [{"value": "1 KB"}],
+ "version_id": "{}".format(obj_v1.version_id),
+ "url": {"url": "http://localhost/record/{0}/files/{1}".format(i, filename)},
+ "file": (base64.b64encode(stream.getvalue())).decode("utf-8"),
+ }
+ ]
+ indexer.upload_metadata(record_data_v1, rec_uuid2, 1, False)
+ item_v1 = ItemsMetadata.create(item_data, id_=rec_uuid2, item_type_id=1)
+
+ db.session.flush()
+ # db.session.expunge_all()
+
+ return {
+ "depid": depid,
+ "recid": recid,
+ "parent": parent,
+ "doi": doi,
+ "hdl": hdl,
+ "record": record,
+ "record_data": record_data,
+ "item": item,
+ "item_data": item_data,
+ "deposit": deposit,
+ "filename": filename,
+ "mimetype": mimetype,
+ "obj": obj,
+ }
+
+def make_record_restricted_open_login(db, indexer, i, filepath, filename, mimetype ,userId ,workflowId, roles):
+ """ make open_resirected open_date record"""
+ record_data = {
+ "_oai": {"id": "oai:weko3.example.org:000000{:02d}".format(i), "sets": ["{}".format((i % 2) + 1)]},
+ "path": ["{}".format((i % 2) + 1)],
+ "owner": 1,
+ "recid": "{}".format(i),
+ "title": [
+ "ja_conference paperITEM00000009(public_open_access_open_access_simple)"
+ ],
+ "pubdate": {"attribute_name": "PubDate", "attribute_value": "2021-08-06"},
+ "_buckets": {"deposit": "27202db8-aefc-4b85-b5ae-4921ac151ddf"},
+ "_deposit": {
+ "id": "{}".format(i),
+ "pid": {"type": "depid", "value": "{}".format(i), "revision_id": 0},
+ "owners": [1],
+ "status": "published",
+ },
+ "item_title": "ja_conference paperITEM00000009(public_open_access_open_access_simple)",
+ "author_link": ["4"],
+ "item_type_id": "1",
+ "publish_date": "2021-08-06",
+ "publish_status": "0",
+ "weko_shared_ids": [],
+ "item_1617186331708": {
+ "attribute_name": "Title",
+ "attribute_value_mlt": [
+ {
+ "subitem_1551255647225": "ja_conference paperITEM00000009(public_open_access_open_access_simple)",
+ "subitem_1551255648112": "ja",
+ },
+ {
+ "subitem_1551255647225": "en_conference paperITEM00000009(public_open_access_simple)",
+ "subitem_1551255648112": "en",
+ },
+ ],
+ },
+ "item_1617186385884": {
+ "attribute_name": "Alternative Title",
+ "attribute_value_mlt": [
+ {
+ "subitem_1551255720400": "Alternative Title",
+ "subitem_1551255721061": "en",
+ },
+ {
+ "subitem_1551255720400": "Alternative Title",
+ "subitem_1551255721061": "ja",
+ },
+ ],
+ },
+ "item_1617186419668": {
+ "attribute_name": "Creator",
+ "attribute_type": "creator",
+ "attribute_value_mlt": [
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "creatorMails": [{"creatorMail": "wekosoftware@nii.ac.jp"}],
+ "creatorNames": [
+ {"creatorName": "情報, 太郎", "creatorNameLang": "ja"},
+ {"creatorName": "ジョウホウ, タロウ", "creatorNameLang": "ja-Kana"},
+ {"creatorName": "Joho, Taro", "creatorNameLang": "en"},
+ ],
+ "nameIdentifiers": [
+ {"nameIdentifier": "4", "nameIdentifierScheme": "WEKO"},
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "zzzzzzz",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ "creatorAffiliations": [
+ {
+ "affiliationNames": [
+ {
+ "affiliationName": "University",
+ "affiliationNameLang": "en",
+ }
+ ],
+ "affiliationNameIdentifiers": [
+ {
+ "affiliationNameIdentifier": "0000000121691048",
+ "affiliationNameIdentifierURI": "http://isni.org/isni/0000000121691048",
+ "affiliationNameIdentifierScheme": "ISNI",
+ }
+ ],
+ }
+ ],
+ },
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "creatorMails": [{"creatorMail": "wekosoftware@nii.ac.jp"}],
+ "creatorNames": [
+ {"creatorName": "情報, 太郎", "creatorNameLang": "ja"},
+ {"creatorName": "ジョウホウ, タロウ", "creatorNameLang": "ja-Kana"},
+ {"creatorName": "Joho, Taro", "creatorNameLang": "en"},
+ ],
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "zzzzzzz",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ },
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "creatorMails": [{"creatorMail": "wekosoftware@nii.ac.jp"}],
+ "creatorNames": [
+ {"creatorName": "情報, 太郎", "creatorNameLang": "ja"},
+ {"creatorName": "ジョウホウ, タロウ", "creatorNameLang": "ja-Kana"},
+ {"creatorName": "Joho, Taro", "creatorNameLang": "en"},
+ ],
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "zzzzzzz",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ },
+ ],
+ },
+ "item_1617186476635": {
+ "attribute_name": "Access Rights",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522299639480": "open access",
+ "subitem_1600958577026": "http://purl.org/coar/access_right/c_abf2",
+ }
+ ],
+ },
+ "item_1617186499011": {
+ "attribute_name": "Rights",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522650717957": "ja",
+ "subitem_1522650727486": "http://localhost",
+ "subitem_1522651041219": "Rights Information",
+ }
+ ],
+ },
+ "item_1617186609386": {
+ "attribute_name": "Subject",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522299896455": "ja",
+ "subitem_1522300014469": "Other",
+ "subitem_1522300048512": "http://localhost/",
+ "subitem_1523261968819": "Sibject1",
+ }
+ ],
+ },
+ "item_1617186626617": {
+ "attribute_name": "Description",
+ "attribute_value_mlt": [
+ {
+ "subitem_description": "Description\nDescription Description",
+ "subitem_description_type": "Abstract",
+ "subitem_description_language": "en",
+ },
+ {
+ "subitem_description": "概要\n概要\n概要\n概要",
+ "subitem_description_type": "Abstract",
+ "subitem_description_language": "ja",
+ },
+ ],
+ },
+ "item_1617186643794": {
+ "attribute_name": "Publisher",
+ "attribute_value_mlt": [
+ {"subitem_1522300295150": "en", "subitem_1522300316516": "Publisher"}
+ ],
+ },
+ "item_1617186660861": {
+ "attribute_name": "Date",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522300695726": "Available",
+ "subitem_1522300722591": "2021-06-30",
+ }
+ ],
+ },
+ "item_1617186702042": {
+ "attribute_name": "Language",
+ "attribute_value_mlt": [{"subitem_1551255818386": "jpn"}],
+ },
+ "item_1617186783814": {
+ "attribute_name": "Identifier",
+ "attribute_value_mlt": [
+ {
+ "subitem_identifier_uri": "http://localhost",
+ "subitem_identifier_type": "URI",
+ }
+ ],
+ },
+ "item_1617186859717": {
+ "attribute_name": "Temporal",
+ "attribute_value_mlt": [
+ {"subitem_1522658018441": "en", "subitem_1522658031721": "Temporal"}
+ ],
+ },
+ "item_1617186882738": {
+ "attribute_name": "Geo Location",
+ "attribute_value_mlt": [
+ {
+ "subitem_geolocation_place": [
+ {"subitem_geolocation_place_text": "Japan"}
+ ]
+ }
+ ],
+ },
+ "item_1617186901218": {
+ "attribute_name": "Funding Reference",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522399143519": {
+ "subitem_1522399281603": "ISNI",
+ "subitem_1522399333375": "http://xxx",
+ },
+ "subitem_1522399412622": [
+ {
+ "subitem_1522399416691": "en",
+ "subitem_1522737543681": "Funder Name",
+ }
+ ],
+ "subitem_1522399571623": {
+ "subitem_1522399585738": "Award URI",
+ "subitem_1522399628911": "Award Number",
+ },
+ "subitem_1522399651758": [
+ {
+ "subitem_1522721910626": "en",
+ "subitem_1522721929892": "Award Title",
+ }
+ ],
+ }
+ ],
+ },
+ "item_1617186920753": {
+ "attribute_name": "Source Identifier",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522646500366": "ISSN",
+ "subitem_1522646572813": "xxxx-xxxx-xxxx",
+ }
+ ],
+ },
+ "item_1617186941041": {
+ "attribute_name": "Source Title",
+ "attribute_value_mlt": [
+ {"subitem_1522650068558": "en", "subitem_1522650091861": "Source Title"}
+ ],
+ },
+ "item_1617186959569": {
+ "attribute_name": "Volume Number",
+ "attribute_value_mlt": [{"subitem_1551256328147": "1"}],
+ },
+ "item_1617186981471": {
+ "attribute_name": "Issue Number",
+ "attribute_value_mlt": [{"subitem_1551256294723": "111"}],
+ },
+ "item_1617186994930": {
+ "attribute_name": "Number of Pages",
+ "attribute_value_mlt": [{"subitem_1551256248092": "12"}],
+ },
+ "item_1617187024783": {
+ "attribute_name": "Page Start",
+ "attribute_value_mlt": [{"subitem_1551256198917": "1"}],
+ },
+ "item_1617187045071": {
+ "attribute_name": "Page End",
+ "attribute_value_mlt": [{"subitem_1551256185532": "3"}],
+ },
+ "item_1617187112279": {
+ "attribute_name": "Degree Name",
+ "attribute_value_mlt": [
+ {"subitem_1551256126428": "Degree Name", "subitem_1551256129013": "en"}
+ ],
+ },
+ "item_1617187136212": {
+ "attribute_name": "Date Granted",
+ "attribute_value_mlt": [{"subitem_1551256096004": "2021-06-30"}],
+ },
+ "item_1617187187528": {
+ "attribute_name": "Conference",
+ "attribute_value_mlt": [
+ {
+ "subitem_1599711633003": [
+ {
+ "subitem_1599711636923": "Conference Name",
+ "subitem_1599711645590": "ja",
+ }
+ ],
+ "subitem_1599711655652": "1",
+ "subitem_1599711660052": [
+ {
+ "subitem_1599711680082": "Sponsor",
+ "subitem_1599711686511": "ja",
+ }
+ ],
+ "subitem_1599711699392": {
+ "subitem_1599711704251": "2020/12/11",
+ "subitem_1599711712451": "1",
+ "subitem_1599711727603": "12",
+ "subitem_1599711731891": "2000",
+ "subitem_1599711735410": "1",
+ "subitem_1599711739022": "12",
+ "subitem_1599711743722": "2020",
+ "subitem_1599711745532": "ja",
+ },
+ "subitem_1599711758470": [
+ {
+ "subitem_1599711769260": "Conference Venue",
+ "subitem_1599711775943": "ja",
+ }
+ ],
+ "subitem_1599711788485": [
+ {
+ "subitem_1599711798761": "Conference Place",
+ "subitem_1599711803382": "ja",
+ }
+ ],
+ "subitem_1599711813532": "JPN",
+ }
+ ],
+ },
+ "item_1617258105262": {
+ "attribute_name": "Resource Type",
+ "attribute_value_mlt": [
+ {
+ "resourceuri": "http://purl.org/coar/resource_type/c_5794",
+ "resourcetype": "conference paper",
+ }
+ ],
+ },
+ "item_1617265215918": {
+ "attribute_name": "Version Type",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522305645492": "AO",
+ "subitem_1600292170262": "http://purl.org/coar/version/c_b1a7d7d4d402bcce",
+ }
+ ],
+ },
+ "item_1617349709064": {
+ "attribute_name": "Contributor",
+ "attribute_value_mlt": [
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "contributorType": "ContactPerson",
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ "contributorMails": [{"contributorMail": "wekosoftware@nii.ac.jp"}],
+ "contributorNames": [
+ {"lang": "ja", "contributorName": "情報, 太郎"},
+ {"lang": "ja-Kana", "contributorName": "ジョウホウ, タロウ"},
+ {"lang": "en", "contributorName": "Joho, Taro"},
+ ],
+ }
+ ],
+ },
+ "item_1617349808926": {
+ "attribute_name": "Version",
+ "attribute_value_mlt": [{"subitem_1523263171732": "Version"}],
+ },
+ "item_1617351524846": {
+ "attribute_name": "APC",
+ "attribute_value_mlt": [{"subitem_1523260933860": "Unknown"}],
+ },
+ "item_1617353299429": {
+ "attribute_name": "Relation",
+ "attribute_value_mlt": [
+ {
+ "subitem_1522306207484": "isVersionOf",
+ "subitem_1522306287251": {
+ "subitem_1522306382014": "arXiv",
+ "subitem_1522306436033": "xxxxx",
+ },
+ "subitem_1523320863692": [
+ {
+ "subitem_1523320867455": "en",
+ "subitem_1523320909613": "Related Title",
+ }
+ ],
+ }
+ ],
+ },
+ "item_1617605131499": {
+ "attribute_name": "File",
+ "attribute_type": "file",
+ "attribute_value_mlt": [
+ {
+ "url": {"url": "https://weko3.example.org/record/{0}/files/{1}".format(
+ i, filename
+ )},
+ "date": [{"dateType": "Available", "dateValue": "2021-07-12"}],
+ "format": "text/plain",
+ "filename": "{}".format(filename),
+ "filesize": [{"value": "1 KB"}],
+ "mimetype": "{}".format(mimetype),
+ "accessrole": "open_login",
+ "roles": roles,
+ "version_id": "c1502853-c2f9-455d-8bec-f6e630e54b21",
+ "displaytype": "simple",
+ "provide": [{"workflow": 1, "role": 1}],
+ "terms": 'term_free' if i%2==0 else '100',
+ "terms_content": 'test terms_content' if i%2==0 else 'terms context',
+ }
+ ],
+ },
+ "item_1617610673286": {
+ "attribute_name": "Rights Holder",
+ "attribute_value_mlt": [
+ {
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ }
+ ],
+ "rightHolderNames": [
+ {
+ "rightHolderName": "Right Holder Name",
+ "rightHolderLanguage": "ja",
+ }
+ ],
+ }
+ ],
+ },
+ "item_1617620223087": {
+ "attribute_name": "Heading",
+ "attribute_value_mlt": [
+ {
+ "subitem_1565671149650": "ja",
+ "subitem_1565671169640": "Banner Headline",
+ "subitem_1565671178623": "Subheading",
+ },
+ {
+ "subitem_1565671149650": "en",
+ "subitem_1565671169640": "Banner Headline",
+ "subitem_1565671178623": "Subheding",
+ },
+ ],
+ },
+ "item_1617944105607": {
+ "attribute_name": "Degree Grantor",
+ "attribute_value_mlt": [
+ {
+ "subitem_1551256015892": [
+ {
+ "subitem_1551256027296": "xxxxxx",
+ "subitem_1551256029891": "kakenhi",
+ }
+ ],
+ "subitem_1551256037922": [
+ {
+ "subitem_1551256042287": "Degree Grantor Name",
+ "subitem_1551256047619": "en",
+ }
+ ],
+ }
+ ],
+ },
+ "relation_version_is_last": True,
+ }
+
+ item_data = {
+ "id": "{}".format(i),
+ "pid": {"type": "recid", "value": "{}".format(i), "revision_id": 0},
+ "path": ["{}".format((i % 2) + 1)],
+ "owner": 1,
+ "title": "ja_conference paperITEM00000009(public_open_access_open_access_simple)",
+ "owners": [1],
+ "status": "draft",
+ "$schema": "https://localhost:8443/items/jsonschema/1",
+ "pubdate": "2021-08-06",
+ "feedback_mail_list": [{"email": "wekosoftware@nii.ac.jp", "author_id": ""}],
+ "item_1617186331708": [
+ {
+ "subitem_1551255647225": "ja_conference paperITEM00000009(public_open_access_open_access_simple)",
+ "subitem_1551255648112": "ja",
+ },
+ {
+ "subitem_1551255647225": "en_conference paperITEM00000009(public_open_access_simple)",
+ "subitem_1551255648112": "en",
+ },
+ ],
+ "item_1617186385884": [
+ {
+ "subitem_1551255720400": "Alternative Title",
+ "subitem_1551255721061": "en",
+ },
+ {
+ "subitem_1551255720400": "Alternative Title",
+ "subitem_1551255721061": "ja",
+ },
+ ],
+ "item_1617186419668": [
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "creatorMails": [{"creatorMail": "wekosoftware@nii.ac.jp"}],
+ "creatorNames": [
+ {"creatorName": "情報, 太郎", "creatorNameLang": "ja"},
+ {"creatorName": "ジョウホウ, タロウ", "creatorNameLang": "ja-Kana"},
+ {"creatorName": "Joho, Taro", "creatorNameLang": "en"},
+ ],
+ "nameIdentifiers": [
+ {"nameIdentifier": "4", "nameIdentifierScheme": "WEKO"},
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "zzzzzzz",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ "creatorAffiliations": [
+ {
+ "affiliationNames": [
+ {
+ "affiliationName": "University",
+ "affiliationNameLang": "en",
+ }
+ ],
+ "affiliationNameIdentifiers": [
+ {
+ "affiliationNameIdentifier": "0000000121691048",
+ "affiliationNameIdentifierURI": "http://isni.org/isni/0000000121691048",
+ "affiliationNameIdentifierScheme": "ISNI",
+ }
+ ],
+ }
+ ],
+ },
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "creatorMails": [{"creatorMail": "wekosoftware@nii.ac.jp"}],
+ "creatorNames": [
+ {"creatorName": "情報, 太郎", "creatorNameLang": "ja"},
+ {"creatorName": "ジョウホウ, タロウ", "creatorNameLang": "ja-Kana"},
+ {"creatorName": "Joho, Taro", "creatorNameLang": "en"},
+ ],
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "zzzzzzz",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ },
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "creatorMails": [{"creatorMail": "wekosoftware@nii.ac.jp"}],
+ "creatorNames": [
+ {"creatorName": "情報, 太郎", "creatorNameLang": "ja"},
+ {"creatorName": "ジョウホウ, タロウ", "creatorNameLang": "ja-Kana"},
+ {"creatorName": "Joho, Taro", "creatorNameLang": "en"},
+ ],
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "zzzzzzz",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ },
+ ],
+ "item_1617186476635": {
+ "subitem_1522299639480": "open access",
+ "subitem_1600958577026": "http://purl.org/coar/access_right/c_abf2",
+ },
+ "item_1617186499011": [
+ {
+ "subitem_1522650717957": "ja",
+ "subitem_1522650727486": "http://localhost",
+ "subitem_1522651041219": "Rights Information",
+ }
+ ],
+ "item_1617186609386": [
+ {
+ "subitem_1522299896455": "ja",
+ "subitem_1522300014469": "Other",
+ "subitem_1522300048512": "http://localhost/",
+ "subitem_1523261968819": "Sibject1",
+ }
+ ],
+ "item_1617186626617": [
+ {
+ "subitem_description": "Description\nDescription Description",
+ "subitem_description_type": "Abstract",
+ "subitem_description_language": "en",
+ },
+ {
+ "subitem_description": "概要\n概要\n概要\n概要",
+ "subitem_description_type": "Abstract",
+ "subitem_description_language": "ja",
+ },
+ ],
+ "item_1617186643794": [
+ {"subitem_1522300295150": "en", "subitem_1522300316516": "Publisher"}
+ ],
+ "item_1617186660861": [
+ {
+ "subitem_1522300695726": "Available",
+ "subitem_1522300722591": "2021-06-30",
+ }
+ ],
+ "item_1617186702042": [{"subitem_1551255818386": "jpn"}],
+ "item_1617186783814": [
+ {
+ "subitem_identifier_uri": "http://localhost",
+ "subitem_identifier_type": "URI",
+ }
+ ],
+ "item_1617186859717": [
+ {"subitem_1522658018441": "en", "subitem_1522658031721": "Temporal"}
+ ],
+ "item_1617186882738": [
+ {"subitem_geolocation_place": [{"subitem_geolocation_place_text": "Japan"}]}
+ ],
+ "item_1617186901218": [
+ {
+ "subitem_1522399143519": {
+ "subitem_1522399281603": "ISNI",
+ "subitem_1522399333375": "http://xxx",
+ },
+ "subitem_1522399412622": [
+ {
+ "subitem_1522399416691": "en",
+ "subitem_1522737543681": "Funder Name",
+ }
+ ],
+ "subitem_1522399571623": {
+ "subitem_1522399585738": "Award URI",
+ "subitem_1522399628911": "Award Number",
+ },
+ "subitem_1522399651758": [
+ {
+ "subitem_1522721910626": "en",
+ "subitem_1522721929892": "Award Title",
+ }
+ ],
+ }
+ ],
+ "item_1617186920753": [
+ {"subitem_1522646500366": "ISSN", "subitem_1522646572813": "xxxx-xxxx-xxxx"}
+ ],
+ "item_1617186941041": [
+ {"subitem_1522650068558": "en", "subitem_1522650091861": "Source Title"}
+ ],
+ "item_1617186959569": {"subitem_1551256328147": "1"},
+ "item_1617186981471": {"subitem_1551256294723": "111"},
+ "item_1617186994930": {"subitem_1551256248092": "12"},
+ "item_1617187024783": {"subitem_1551256198917": "1"},
+ "item_1617187045071": {"subitem_1551256185532": "3"},
+ "item_1617187112279": [
+ {"subitem_1551256126428": "Degree Name", "subitem_1551256129013": "en"}
+ ],
+ "item_1617187136212": {"subitem_1551256096004": "2021-06-30"},
+ "item_1617187187528": [
+ {
+ "subitem_1599711633003": [
+ {
+ "subitem_1599711636923": "Conference Name",
+ "subitem_1599711645590": "ja",
+ }
+ ],
+ "subitem_1599711655652": "1",
+ "subitem_1599711660052": [
+ {"subitem_1599711680082": "Sponsor", "subitem_1599711686511": "ja"}
+ ],
+ "subitem_1599711699392": {
+ "subitem_1599711704251": "2020/12/11",
+ "subitem_1599711712451": "1",
+ "subitem_1599711727603": "12",
+ "subitem_1599711731891": "2000",
+ "subitem_1599711735410": "1",
+ "subitem_1599711739022": "12",
+ "subitem_1599711743722": "2020",
+ "subitem_1599711745532": "ja",
+ },
+ "subitem_1599711758470": [
+ {
+ "subitem_1599711769260": "Conference Venue",
+ "subitem_1599711775943": "ja",
+ }
+ ],
+ "subitem_1599711788485": [
+ {
+ "subitem_1599711798761": "Conference Place",
+ "subitem_1599711803382": "ja",
+ }
+ ],
+ "subitem_1599711813532": "JPN",
+ }
+ ],
+ "item_1617258105262": {
+ "resourceuri": "http://purl.org/coar/resource_type/c_5794",
+ "resourcetype": "conference paper",
+ },
+ "item_1617265215918": {
+ "subitem_1522305645492": "AO",
+ "subitem_1600292170262": "http://purl.org/coar/version/c_b1a7d7d4d402bcce",
+ },
+ "item_1617349709064": [
+ {
+ "givenNames": [
+ {"givenName": "太郎", "givenNameLang": "ja"},
+ {"givenName": "タロウ", "givenNameLang": "ja-Kana"},
+ {"givenName": "Taro", "givenNameLang": "en"},
+ ],
+ "familyNames": [
+ {"familyName": "情報", "familyNameLang": "ja"},
+ {"familyName": "ジョウホウ", "familyNameLang": "ja-Kana"},
+ {"familyName": "Joho", "familyNameLang": "en"},
+ ],
+ "contributorType": "ContactPerson",
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://ci.nii.ac.jp/",
+ "nameIdentifierScheme": "CiNii",
+ },
+ {
+ "nameIdentifier": "xxxxxxx",
+ "nameIdentifierURI": "https://kaken.nii.ac.jp/",
+ "nameIdentifierScheme": "KAKEN2",
+ },
+ ],
+ "contributorMails": [{"contributorMail": "wekosoftware@nii.ac.jp"}],
+ "contributorNames": [
+ {"lang": "ja", "contributorName": "情報, 太郎"},
+ {"lang": "ja-Kana", "contributorName": "ジョウホ, タロウ"},
+ {"lang": "en", "contributorName": "Joho, Taro"},
+ ],
+ }
+ ],
+ "item_1617349808926": {"subitem_1523263171732": "Version"},
+ "item_1617351524846": {"subitem_1523260933860": "Unknown"},
+ "item_1617353299429": [
+ {
+ "subitem_1522306207484": "isVersionOf",
+ "subitem_1522306287251": {
+ "subitem_1522306382014": "arXiv",
+ "subitem_1522306436033": "xxxxx",
+ },
+ "subitem_1523320863692": [
+ {
+ "subitem_1523320867455": "en",
+ "subitem_1523320909613": "Related Title",
+ }
+ ],
+ }
+ ],
+ "item_1617605131499": [
+ {
+ "url": {
+ "url": "https://weko3.example.org/record/{0}/files/{1}".format(i,filename)
+ },
+ "date": [{"dateType": "Available", "dateValue": "2021-07-12"}],
+ "format": "{}".format(mimetype),
+ "filename": "{}".format(filename),
+ "filesize": [{"value": "1 KB"}],
+ "mimetype": "{}".format(mimetype),
+ "accessrole": "open_login",
+ "roles": roles,
+ "version_id": "c1502853-c2f9-455d-8bec-f6e630e54b21",
+ "displaytype": "simple",
+ "provide": [{"workflow": 1, "role": 1}],
+ "terms": 'term_free' if i%2==0 else '100',
+ "terms_content": 'test terms_content' if i%2==0 else 'terms context',
+ }
+ ],
+ "item_1617610673286": [
+ {
+ "nameIdentifiers": [
+ {
+ "nameIdentifier": "xxxxxx",
+ "nameIdentifierURI": "https://orcid.org/",
+ "nameIdentifierScheme": "ORCID",
+ }
+ ],
+ "rightHolderNames": [
+ {
+ "rightHolderName": "Right Holder Name",
+ "rightHolderLanguage": "ja",
+ }
+ ],
+ }
+ ],
+ "item_1617620223087": [
+ {
+ "subitem_1565671149650": "ja",
+ "subitem_1565671169640": "Banner Headline",
+ "subitem_1565671178623": "Subheading",
+ },
+ {
+ "subitem_1565671149650": "en",
+ "subitem_1565671169640": "Banner Headline",
+ "subitem_1565671178623": "Subheding",
+ },
+ ],
+ "item_1617944105607": [
+ {
+ "subitem_1551256015892": [
+ {
+ "subitem_1551256027296": "xxxxxx",
+ "subitem_1551256029891": "kakenhi",
+ }
+ ],
+ "subitem_1551256037922": [
+ {
+ "subitem_1551256042287": "Degree Grantor Name",
+ "subitem_1551256047619": "en",
+ }
+ ],
+ }
+ ],
+ }
+
+ rec_uuid = uuid.uuid4()
+
+ recid = PersistentIdentifier.create(
+ "recid",
+ str(i),
+ object_type="rec",
+ object_uuid=rec_uuid,
+ status=PIDStatus.REGISTERED,
+ )
+ depid = PersistentIdentifier.create(
+ "depid",
+ str(i),
+ object_type="rec",
+ object_uuid=rec_uuid,
+ status=PIDStatus.REGISTERED,
+ )
+ parent = None
+ doi = None
+ hdl = None
+ recid_v1 = PersistentIdentifier.create(
+ "recid",
+ str(i + 0.1),
+ object_type="rec",
+ object_uuid=rec_uuid,
+ status=PIDStatus.REGISTERED,
+ )
+ rec_uuid2 = uuid.uuid4()
+ depid_v1 = PersistentIdentifier.create(
+ "depid",
+ str(i + 0.1),
+ object_type="rec",
+ object_uuid=rec_uuid2,
+ status=PIDStatus.REGISTERED,
+ )
+ parent = PersistentIdentifier.create(
+ "parent",
+ "parent:{}".format(i),
+ object_type="rec",
+ object_uuid=rec_uuid2,
+ status=PIDStatus.REGISTERED,
+ )
+
+ h1 = PIDVersioning(parent=parent)
+ h1.insert_child(child=recid)
+ h1.insert_child(child=recid_v1)
+ RecordDraft.link(recid, depid)
+ RecordDraft.link(recid_v1, depid_v1)
+
+ if i % 2 == 1:
+ doi = PersistentIdentifier.create(
+ "doi",
+ "https://doi.org/10.xyz/{}".format((str(i)).zfill(10)),
+ object_type="rec",
+ object_uuid=rec_uuid,
+ status=PIDStatus.REGISTERED,
+ )
+ hdl = PersistentIdentifier.create(
+ "hdl",
+ "https://hdl.handle.net/0000/{}".format((str(i)).zfill(10)),
+ object_type="rec",
+ object_uuid=rec_uuid,
+ status=PIDStatus.REGISTERED,
+ )
+
+ record = WekoRecord.create(record_data, id_=rec_uuid)
+ # from six import BytesIO
+ import base64
+
+ bucket = Bucket.create()
+ record_buckets = RecordsBuckets.create(record=record.model, bucket=bucket)
+
+ # stream = BytesIO(b"Hello, World")
+ obj = None
+ with open(filepath, "rb") as f:
+ stream = BytesIO(f.read())
+ record.files[filename] = stream
+ record["item_1617605131499"]["attribute_value_mlt"][0]["file"] = (
+ base64.b64encode(stream.getvalue())
+ ).decode("utf-8")
+ with open(filepath, "rb") as f:
+ obj = ObjectVersion.create(bucket=bucket.id, key=filename, stream=f)
+ deposit = aWekoDeposit(record, record.model)
+ deposit.commit()
+ record["item_1617605131499"]["attribute_value_mlt"][0]["version_id"] = str(
+ obj.version_id
+ )
+
+ record_data["content"] = [
+ {
+ "date": [{"dateValue": "2021-07-12", "dateType": "Available"}],
+ "accessrole": "open_login",
+ "roles" : roles,
+ "terms" :"term_free","termsDescription":"利用規約本文",
+ "displaytype": "simple",
+ "filename": filename,
+ "attachment": {},
+ "format": mimetype,
+ "mimetype": mimetype,
+ "filesize": [{"value": "1 KB"}],
+ "version_id": "{}".format(obj.version_id),
+ "url": {"url": "http://localhost/record/{0}/files/{1}".format(i, filename)},
+ "file": (base64.b64encode(stream.getvalue())).decode("utf-8"),
+ }
+ ]
+ indexer.upload_metadata(record_data, rec_uuid, 1, False)
+ item = ItemsMetadata.create(item_data, id_=rec_uuid, item_type_id=1)
+
+ record_v1 = WekoRecord.create(record_data, id_=rec_uuid2)
+ # from six import BytesIO
+ import base64
+
+ bucket_v1 = Bucket.create()
+ record_buckets = RecordsBuckets.create(record=record_v1.model, bucket=bucket_v1)
+ # stream = BytesIO(b"Hello, World")
+ record_v1.files[filename] = stream
+ obj_v1 = ObjectVersion.create(bucket=bucket_v1.id, key=filename, stream=stream)
+ record_v1["item_1617605131499"]["attribute_value_mlt"][0]["file"] = (
+ base64.b64encode(stream.getvalue())
+ ).decode("utf-8")
+ deposit_v1 = aWekoDeposit(record_v1, record_v1.model)
+ deposit_v1.commit()
+ record_v1["item_1617605131499"]["attribute_value_mlt"][0]["version_id"] = str(
+ obj_v1.version_id
+ )
+
+ record_data_v1 = copy.deepcopy(record_data)
+ record_data_v1["content"] = [
+ {
+ "date": [{"dateValue": "2021-07-12", "dateType": "Available"}],
+ "accessrole": "open_login",
+ "roles" : roles,
+ "terms" :"term_free","termsDescription":"利用規約本文",
+ "displaytype": "simple",
+ "filename": filename,
+ "attachment": {},
+ "format": mimetype,
+ "mimetype": mimetype,
+ "filesize": [{"value": "1 KB"}],
+ "version_id": "{}".format(obj_v1.version_id),
+ "url": {"url": "http://localhost/record/{0}/files/{1}".format(i, filename)},
+ "file": (base64.b64encode(stream.getvalue())).decode("utf-8"),
+ }
+ ]
+ indexer.upload_metadata(record_data_v1, rec_uuid2, 1, False)
+ item_v1 = ItemsMetadata.create(item_data, id_=rec_uuid2, item_type_id=1)
+
+ db.session.flush()
+ # db.session.expunge_all()
+
+ return {
+ "depid": depid,
+ "recid": recid,
+ "parent": parent,
+ "doi": doi,
+ "hdl": hdl,
+ "record": record,
+ "record_data": record_data,
+ "item": item,
+ "item_data": item_data,
+ "deposit": deposit,
+ "filename": filename,
+ "mimetype": mimetype,
+ "obj": obj,
+ }
+
+@pytest.fixture()
+def workflow_actions(app, db):
+ # workflow_action
+ action_datas = dict()
+ with open("tests/data/actions.json", "r") as f:
+ action_datas = json.load(f)
+ actions_db = list()
+ with db.session.begin_nested():
+ for data in action_datas:
+ actions_db.append(Action(**data))
+ db.session.add_all(actions_db)
+
+ #workflow_action_status
+ actionstatus_datas = dict()
+ with open("tests/data/action_status.json") as f:
+ actionstatus_datas = json.load(f)
+ actionstatus_db = list()
+ with db.session.begin_nested():
+ for data in actionstatus_datas:
+ actionstatus_db.append(ActionStatus(**data))
+ db.session.add_all(actionstatus_db)
+
+
+@pytest.fixture()
+def workflows(app, db, workflow_actions, itemtypes, users, records):
+ flow_id = uuid.uuid4()
+ flow_define = FlowDefine(
+ flow_id=flow_id, flow_name="Registration Flow", flow_user=1, flow_status="A"
+ )
+ flow_action1 = FlowAction(
+ status="N",
+ flow_id=flow_id,
+ action_id=1,
+ action_version="1.0.0",
+ action_order=1,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={},
+ )
+ flow_action2 = FlowAction(
+ status="N",
+ flow_id=flow_id,
+ action_id=3,
+ action_version="1.0.0",
+ action_order=2,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={},
+ )
+ flow_action3 = FlowAction(
+ status="N",
+ flow_id=flow_id,
+ action_id=5,
+ action_version="1.0.0",
+ action_order=3,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={},
+ )
+
+ def_workflow = WorkFlow(
+ flows_id=uuid.uuid4(),
+ flows_name="test workflow1",
+ itemtype_id=1,
+ index_tree_id=None,
+ flow_id=1,
+ is_deleted=False,
+ open_restricted=False,
+ location_id=None,
+ is_gakuninrdm=False,
+ )
+ data_usage_workflow = WorkFlow(
+ flows_id=uuid.uuid4(),
+ flows_name="Data Usage Report",
+ itemtype_id=1,
+ index_tree_id=None,
+ flow_id=1,
+ is_deleted=False,
+ open_restricted=False,
+ location_id=None,
+ is_gakuninrdm=False,
+ )
+ def_activity = Activity(
+ activity_id="A-00000000-00000",
+ workflow_id=1,
+ flow_id=flow_define.id,
+ action_id=1,
+ activity_login_user=1,
+ activity_update_user=1,
+ activity_start=datetime.strptime(
+ "2022/04/14 3:01:53.931", "%Y/%m/%d %H:%M:%S.%f"
+ ),
+ activity_community_id=3,
+ activity_confirm_term_of_use=True,
+ title="test",
+ shared_user_ids=[],
+ extra_info={},
+ action_order=6,
+ )
+ data_usage_activity = Activity(
+ item_id=records[1][0]['record'].id,
+ activity_id="usage_application_activity_id_dummy1",
+ workflow_id=1,
+ flow_id=flow_define.id,
+ action_id=1,
+ activity_login_user=1,
+ activity_update_user=1,
+ activity_start=datetime.strptime(
+ "2022/04/14 3:01:53.931", "%Y/%m/%d %H:%M:%S.%f"
+ ),
+ activity_community_id=3,
+ activity_confirm_term_of_use=True,
+ title="Data Usage Report",
+ shared_user_ids=[],
+ extra_info={
+ "related_title": "Data Usage Report",
+ "record_id": 1,
+ "file_name": records[1][0]["filename"],
+ "guest_mail": "guest@nii.co.jp",
+ "user_mail": "user@nii.co.jp"
+ },
+ action_order=6,
+ )
+ guest_activity = GuestActivity(
+ user_mail="guest@nii.co.jp",
+ record_id=1,
+ file_name=records[1][0]["filename"],
+ activity_id='',
+ token='',
+ expiration_date=datetime.now()
+ )
+
+ with db.session.begin_nested():
+ db.session.add(flow_define)
+ db.session.add(flow_action1)
+ db.session.add(flow_action2)
+ db.session.add(flow_action3)
+ db.session.add(def_workflow)
+ db.session.add(data_usage_workflow)
+ db.session.add(def_activity)
+ db.session.add(data_usage_activity)
+ db.session.add(guest_activity)
+
+ return {
+ "flow_define": flow_define,
+ "workflow": def_workflow,
+ "data_usage_wf": data_usage_workflow,
+ "activity": def_activity,
+ "guest_activity": guest_activity,
+ "data_usage_activity": data_usage_activity,
+ "flow_action1": flow_action1,
+ "flow_action2": flow_action2,
+ "flow_action3": flow_action3,
+ }
+
+@pytest.fixture()
+def workflows_restricted(db ,workflow_actions, itemtypes,users, records):
+ workflows = {}
+
+ flow_id1 = uuid.uuid4()
+ flow_id2 = uuid.uuid4()
+ flow_id3 = uuid.uuid4()
+ flow_id4 = uuid.uuid4()
+
+ #workflow_flow_define
+ flow_define1 = FlowDefine(
+ flow_id=flow_id1, flow_name="登録のみF", flow_user=1, flow_status="A"
+ )
+ flow_define2 = FlowDefine(
+ flow_id=flow_id2, flow_name="利用規約のみF", flow_user=1, flow_status="M"
+ )
+ flow_define3 = FlowDefine(
+ flow_id=flow_id3, flow_name="利用申請F", flow_user=1, flow_status="A"
+ )
+ flow_define4 = FlowDefine(
+ flow_id=flow_id4, flow_name="2段階利用申請F", flow_user=1, flow_status="A"
+ )
+
+ # workflow_flow_action
+ flow_action1_1 = FlowAction(
+ status="N",
+ flow_id=flow_id1,
+ action_id=1,
+ action_version="1.0.0",
+ action_order=1,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={"inform_reject": False, "inform_approval": False, "request_approval": False},
+ )
+ flow_action1_2 = FlowAction(
+ status="N",
+ flow_id=flow_id1,
+ action_id=2,
+ action_version="1.0.0",
+ action_order=3,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={"inform_reject": False, "inform_approval": False, "request_approval": False},
+ )
+ flow_action1_3 = FlowAction(
+ status="N",
+ flow_id=flow_id1,
+ action_id=3,
+ action_version="1.0.1",
+ action_order=2,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={"inform_reject": False, "inform_approval": True, "request_approval": False},
+ )
+ flow_action2_1 = FlowAction(
+ status="N",
+ flow_id=flow_id2,
+ action_id=1,
+ action_version="1.0.0",
+ action_order=1,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={},
+ )
+ flow_action2_2 = FlowAction(
+ status="N",
+ flow_id=flow_id2,
+ action_id=2,
+ action_version="1.0.0",
+ action_order=2,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={},
+ )
+ flow_action3_1 = FlowAction(
+ status="N",
+ flow_id=flow_id3,
+ action_id=1,
+ action_version="1.0.0",
+ action_order=1,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={"inform_reject": False, "inform_approval": False, "request_approval": False},
+ )
+ flow_action3_2 = FlowAction(
+ status="N",
+ flow_id=flow_id3,
+ action_id=2,
+ action_version="1.0.0",
+ action_order=4,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={"inform_reject": False, "inform_approval": False, "request_approval": False},
+ )
+ flow_action3_3 = FlowAction(
+ status="N",
+ flow_id=flow_id3,
+ action_id=3,
+ action_version="1.0.1",
+ action_order=2,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={"inform_reject": False, "inform_approval": False, "request_approval": False},
+ )
+ flow_action3_4 = FlowAction(
+ status="N",
+ flow_id=flow_id3,
+ action_id=4,
+ action_version="2.0.0",
+ action_order=3,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={"inform_reject": True, "inform_approval": True, "request_approval": True},
+ )
+ flow_action4_1 = FlowAction(
+ status="N",
+ flow_id=flow_id4,
+ action_id=1,
+ action_version="1.0.0",
+ action_order=1,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={"inform_reject": False, "inform_approval": False, "request_approval": False},
+ )
+ flow_action4_2 = FlowAction(
+ status="N",
+ flow_id=flow_id4,
+ action_id=2,
+ action_version="1.0.0",
+ action_order=5,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={"inform_reject": False, "inform_approval": False, "request_approval": False},
+ )
+ flow_action4_3 = FlowAction(
+ status="N",
+ flow_id=flow_id4,
+ action_id=3,
+ action_version="1.0.1",
+ action_order=2,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={"inform_reject": False, "inform_approval": False, "request_approval": False},
+ )
+ flow_action4_4 = FlowAction(
+ status="N",
+ flow_id=flow_id4,
+ action_id=4,
+ action_version="2.0.0",
+ action_order=3,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={"inform_reject": True, "inform_approval": True, "request_approval": True},
+ )
+ flow_action4_5 = FlowAction(
+ status="N",
+ flow_id=flow_id4,
+ action_id=4,
+ action_version="2.0.0",
+ action_order=4,
+ action_condition="",
+ action_status="A",
+ action_date=datetime.strptime("2018/07/28 0:00:00", "%Y/%m/%d %H:%M:%S"),
+ send_mail_setting={"inform_reject": True, "inform_approval": True, "request_approval": True},
+ )
+
+
+ with db.session.begin_nested():
+ db.session.add_all([flow_define1,flow_define2,flow_define3,flow_define4])
+
+ #workflow_workflow
+ workflow_workflow1 = WorkFlow(
+ flows_id=flow_id1,
+ flows_name="利用登録",
+ itemtype_id=31001,
+ index_tree_id=None,
+ flow_id=flow_define1.id,
+ flow_define=flow_define1,
+ is_deleted=False,
+ open_restricted=True,
+ # location_id=location.id,
+ # location=location,
+ is_gakuninrdm=False,
+ )
+ workflow_workflow2 = WorkFlow(
+ flows_id=flow_id2,
+ flows_name="利用規約のみ",
+ itemtype_id=31001,
+ index_tree_id=None,
+ flow_id=flow_define2.id,
+ flow_define=flow_define2,
+ is_deleted=False,
+ open_restricted=True,
+ # location_id=location.id,
+ # location=location,
+ is_gakuninrdm=False,
+ )
+ workflow_workflow3 = WorkFlow(
+ flows_id=flow_id3,
+ flows_name="利用申請",
+ itemtype_id=31001,
+ index_tree_id=None,
+ flow_id=flow_define3.id,
+ flow_define=flow_define3,
+ is_deleted=False,
+ open_restricted=True,
+ # location_id=location.id,
+ # location=location,
+ is_gakuninrdm=False,
+ )
+ workflow_workflow4 = WorkFlow(
+ flows_id=flow_id4,
+ flows_name="2段階利用申請",
+ itemtype_id=31002,
+ index_tree_id=None,
+ flow_id=flow_define4.id,
+ flow_define=flow_define4,
+ is_deleted=False,
+ open_restricted=True,
+ # location_id=location.id,
+ # location=location,
+ is_gakuninrdm=False,
+ )
+ db.session.flush()
+
+ with db.session.begin_nested():
+ db.session.add_all([flow_action1_1,flow_action1_2,flow_action1_3])
+ db.session.add_all([flow_action2_1,flow_action2_2])
+ db.session.add_all([flow_action3_1,flow_action3_2,flow_action3_3,flow_action3_4])
+ db.session.add_all([flow_action4_1,flow_action4_2,flow_action4_3,flow_action4_4,flow_action4_5])
+ db.session.add_all([workflow_workflow1, workflow_workflow2, workflow_workflow3, workflow_workflow4])
+
+ workflows.update({
+ "flow_define1" : flow_define1
+ ,"flow_define2" : flow_define2
+ ,"flow_define3" : flow_define3
+ ,"flow_define4" : flow_define4
+ ,"flow_action1_1" : flow_action1_1
+ ,"flow_action1_2" : flow_action1_2
+ ,"flow_action1_3" : flow_action1_3
+ ,"flow_action2_1" : flow_action2_1
+ ,"flow_action2_2" : flow_action2_2
+ ,"flow_action3_1" : flow_action3_1
+ ,"flow_action3_2" : flow_action3_2
+ ,"flow_action3_3" : flow_action3_3
+ ,"flow_action3_4" : flow_action3_4
+ ,"flow_action4_1" : flow_action4_1
+ ,"flow_action4_2" : flow_action4_2
+ ,"flow_action4_3" : flow_action4_3
+ ,"flow_action4_4" : flow_action4_4
+ ,"flow_action4_5" : flow_action4_5
+ ,"workflow_workflow1" : workflow_workflow1
+ ,"workflow_workflow2" : workflow_workflow2
+ ,"workflow_workflow3" : workflow_workflow3
+ ,"workflow_workflow4" : workflow_workflow4
+ })
+
+ return workflows
+
+
+@pytest.fixture()
+def pdfcoverpagesetting(db):
+ with db.session.begin_nested():
+ setting = PDFCoverPageSettings("enable", "string", "Weko Univ", "", "center")
+ db.session.add(setting)
+
+
+@pytest.fixture()
+def site_license_info(app, db):
+ record = SiteLicenseInfo(
+ organization_id=1,
+ organization_name='test',
+ domain_name='domain',
+ mail_address='nii@nii.co.jp',
+ receive_mail_flag=False)
+ with db.session.begin_nested():
+ db.session.add(record)
+ return record
+
+@pytest.fixture()
+def site_license_ipaddr(app, db,site_license_info):
+ record1 = SiteLicenseIpAddress(organization_id=1,organization_no=1,start_ip_address="192.168.0.0",finish_ip_address="192.168.0.255")
+ # record2 = SiteLicenseIpAddress(organization_id=1,start_ip_address="192.168.1.0",finish_ip_address="192.168.2.255")
+ with db.session.begin_nested():
+ db.session.add(record1)
+ # db.session.add(record2)
+ return record1
+
+@pytest.fixture()
+def db_fileonetimedownload(app, db):
+ record = FileOnetimeDownload(
+ file_name="helloworld.pdf",
+ user_mail="wekosoftware@nii.ac.jp",
+ record_id='1',
+ download_count=10,
+ expiration_date=0,
+ extra_info=str({"is_guest": True, "send_usage_report": True, "usage_application_activity_id": "","password_for_download":"test_pass"})
+ )
+ db.session.add(record)
+ return record
+
+
+@pytest.fixture()
+def db_file_permission(app, db,users,records_restricted):
+ indexer, results = records_restricted
+ recid0 = results[0]["recid"]
+ filename0 = results[0]["filename"]
+ record0 = FilePermission(
+ user_id=1, record_id=recid0.pid_value, file_name=filename0,
+ usage_application_activity_id="usage_application_activity_id_dummy1",
+ usage_report_activity_id=None, status=1,
+ )
+ email = list(filter(lambda x : x['email'] if x['id'] == record0.user_id else None,users))[0]['email']
+ record0_onetime=FileOnetimeDownload(user_mail=email
+ ,record_id=recid0.pid_value
+ ,file_name=filename0
+ ,download_count=1
+ ,expiration_date=1
+ ,extra_info=str({}))
+ recid1 = results[1]["recid"]
+ filename1 = results[1]["filename"]
+ record1 = FilePermission(
+ user_id=1, record_id=recid1.pid_value, file_name=filename1,
+ usage_application_activity_id="usage_application_activity_id_dummy1",
+ usage_report_activity_id="usage_report_activity_id_dummy1",status=1,
+ )
+ email = list(filter(lambda x : x['email'] if x['id'] == record1.user_id else None,users))[0]['email']
+ record1_onetime=FileOnetimeDownload(user_mail=email
+ ,record_id=recid1.pid_value
+ ,file_name=filename1
+ ,download_count=1
+ ,expiration_date=1
+ ,extra_info=str({}))
+ recid2 = results[2]["recid"]
+ filename2 = results[2]["filename"]
record2 = FilePermission(
user_id=1, record_id=recid2.pid_value, file_name=filename2,
usage_application_activity_id="usage_application_activity_id_dummy1",
usage_report_activity_id="usage_report_activity_id_dummy1",status=1,
)
+ email = list(filter(lambda x : x['email'] if x['id'] == record2.user_id else None,users))[0]['email']
+ record2_onetime=FileOnetimeDownload(user_mail=email
+ ,record_id=recid2.pid_value
+ ,file_name=filename2
+ ,download_count=1
+ ,expiration_date=1
+ ,extra_info=str({}))
+
+ # not approved yet
+ recid3 = results[len(results)-1]["recid"]
+ filename3 = results[len(results)-1]["filename"]
+ record3 = FilePermission(
+ user_id=users[0]['id'], record_id=recid3.pid_value, file_name=filename3,
+ usage_application_activity_id="usage_application_activity_id_dummy1",
+ usage_report_activity_id=None, status=-1,
+ )
+
+ recid4 = results[len(results)-1]["recid"]
+ filename4 = results[len(results)-1]["filename"]
+ record4 = FilePermission(
+ user_id=users[0]['id'], record_id=recid4.pid_value, file_name=filename4,
+ usage_application_activity_id="usage_application_activity_id_dummy1",
+ usage_report_activity_id=None, status=1,
+ )
+ email = list(filter(lambda x : x['email'] if x['id'] == record4.user_id else None,users))[0]['email']
+ record4_onetime=FileOnetimeDownload(user_mail =email
+ ,record_id=recid4.pid_value
+ ,file_name=filename4
+ ,download_count =1
+ ,expiration_date=1
+ ,extra_info=str({}))
+
+ recid5 = results[len(results)-1]["recid"]
+ filename5 = results[len(results)-1]["filename"]
+ record5 = FilePermission(
+ user_id=users[0]['id'], record_id=recid5.pid_value, file_name=filename5,
+ usage_application_activity_id="usage_application_activity_id_dummy1",
+ usage_report_activity_id=None, status=1,
+ )
+ email = list(filter(lambda x : x['email'] if x['id'] == record5.user_id else None,users))[0]['email']
+ record5_onetime=FileOnetimeDownload(user_mail=email
+ ,record_id=recid5.pid_value
+ ,file_name=filename5
+ ,download_count=1
+ ,expiration_date=1
+ ,extra_info=str({}))
with db.session.begin_nested():
db.session.add(record0)
db.session.add(record1)
db.session.add(record2)
- return [record0,record1,record2]
+ db.session.add(record3)
+ db.session.add(record4)
+ db.session.add(record5)
+ db.session.add(record0_onetime)
+ db.session.add(record1_onetime)
+ db.session.add(record2_onetime)
+ # db.session.add(record3_onetime)
+ db.session.add(record4_onetime)
+ db.session.add(record5_onetime)
+
+ return [record0,record1,record2,record3,record4,record5]
@pytest.fixture()
@@ -2051,4 +4823,424 @@ def db_admin_settings(db):
db.session.add(AdminSettings(id=3,name='site_license_mail_settings',settings={"auto_send_flag": False}))
db.session.add(AdminSettings(id=4,name='default_properties_settings',settings={"show_flag": True}))
db.session.add(AdminSettings(id=5,name='item_export_settings',settings={"allow_item_exporting": True, "enable_contents_exporting": True}))
- db.session.commit()
\ No newline at end of file
+ db.session.commit()
+
+@pytest.fixture()
+def db_restricted_access_secret(db):
+ with db.session.begin_nested():
+ db.session.add(AdminSettings(id=6,name='restricted_access',settings={"secret_URL_file_download": {"secret_enable": True, "secret_download_limit": 1, "secret_expiration_date": 1, "secret_download_limit_unlimited_chk": False, "secret_expiration_date_unlimited_chk": False}}))
+ db.session.commit()
+
+@pytest.fixture()
+def db_community(db , users ,indextree):
+ from invenio_communities.models import Community
+ comm : Community
+ with db.session.begin_nested():
+ comm = Community(
+ id="community"
+ ,id_role = users[0]["id"]
+ ,root_node_id=Index.get_index_by_id(1).id
+ ,id_user = users[0]["id"]
+ )
+ db.session.add(comm)
+ db.session.flush()
+
+ return comm
+
+@pytest.fixture()
+def db_mailTemplateGenre(db):
+ from invenio_mail.models import MailTemplateGenres
+ with db.session.begin_nested():
+ db.session.add(MailTemplateGenres(id=1,name='Notification of secret URL provision'))
+ db.session.commit()
+
+@pytest.fixture()
+def db_mailtemplates(db):
+ from invenio_mail.models import MailTemplates
+ with db.session.begin_nested():
+ db.session.add(MailTemplates(id=1,mail_subject="test_subject",mail_body="test_mail_body",default_mail=True,mail_genre_id=1))
+ db.session.commit()
+
+@pytest.fixture()
+def make_record_need_restricted_access(app, db, workflows, users):
+ """make open_resirected record."""
+
+ record_data_list = []
+ with open('tests/data/need_restricted_access_records_metadata.json', 'r') as f:
+ record_data_list = json.load(f)
+
+ # 1. Not restricted access.
+ rec_id11 = 11
+ rec_id11_1 = 11.1
+ rec_uuid11 = uuid.uuid4()
+ rec_uuid11_1 = uuid.uuid4()
+ recid11 = PersistentIdentifier.create('recid', str(rec_id11), object_type='rec', object_uuid=rec_uuid11, status=PIDStatus.REGISTERED,)
+ recid11_1 = PersistentIdentifier.create('recid', str(rec_id11_1), object_type='rec', object_uuid=rec_uuid11_1, status=PIDStatus.REGISTERED,)
+ depid11 = PersistentIdentifier.create('depid', str(rec_id11), object_type='rec', object_uuid=rec_uuid11, status=PIDStatus.REGISTERED,)
+ depid11_1 = PersistentIdentifier.create('depid', str(rec_id11_1), object_type='rec', object_uuid=rec_uuid11_1, status=PIDStatus.REGISTERED,)
+ parent11 = PersistentIdentifier.create('parent', f'parent:{rec_id11}', object_type='rec', object_uuid=rec_uuid11, status=PIDStatus.REGISTERED,)
+ rel11 = PIDRelation.create(parent11, recid11, 2, 0)
+ rel11_1 = PIDRelation.create(parent11, recid11_1, 2, 1)
+ dep_rel11 = PIDRelation.create(recid11, depid11, 3)
+ dep_rel11_1 = PIDRelation.create(recid11_1, depid11_1, 3)
+ record11 = WekoRecord.create(record_data_list[0], id_=rec_uuid11)
+
+ activity11 = Activity(
+ activity_id='11',
+ item_id=rec_uuid11_1,
+ workflow_id=1,
+ flow_id=workflows['flow_define'].id,
+ activity_start=datetime.strptime('2023/07/01 10:00:00.000', '%Y/%m/%d %H:%M:%S.%f'),
+ activity_end=datetime.strptime('2023/07/01 11:00:00.000', '%Y/%m/%d %H:%M:%S.%f'),
+ activity_status='F',
+ title='test1',
+ action_order=1,
+ )
+
+ # 2. Normal data
+ rec_id12 = 12
+ rec_id12_1 = 12.1
+ rec_uuid12 = uuid.uuid4()
+ rec_uuid12_1 = uuid.uuid4()
+ recid12 = PersistentIdentifier.create('recid', str(rec_id12), object_type='rec', object_uuid=rec_uuid12, status=PIDStatus.REGISTERED,)
+ recid12_1 = PersistentIdentifier.create('recid', str(rec_id12_1), object_type='rec', object_uuid=rec_uuid12_1, status=PIDStatus.REGISTERED,)
+ depid12 = PersistentIdentifier.create('depid', str(rec_id12), object_type='rec', object_uuid=rec_uuid12, status=PIDStatus.REGISTERED,)
+ depid12_1 = PersistentIdentifier.create('depid', str(rec_id12_1), object_type='rec', object_uuid=rec_uuid12_1, status=PIDStatus.REGISTERED,)
+ parent12 = PersistentIdentifier.create('parent', f'parent:{rec_id12}', object_type='rec', object_uuid=rec_uuid12, status=PIDStatus.REGISTERED,)
+ rel12 = PIDRelation.create(parent12, recid12, 2, 0)
+ rel12_1 = PIDRelation.create(parent12, recid12_1, 2, 1)
+ dep_rel12 = PIDRelation.create(recid12, depid12, 3)
+ dep_rel12_1 = PIDRelation.create(recid12_1, depid12_1, 3)
+ record12 = WekoRecord.create(record_data_list[1], id_=rec_uuid12)
+
+ activity12 = Activity(
+ activity_id='12',
+ item_id=rec_uuid12_1,
+ workflow_id=1,
+ flow_id=workflows['flow_define'].id,
+ activity_start=datetime.strptime('2023/07/01 10:00:00.000', '%Y/%m/%d %H:%M:%S.%f'),
+ activity_end=datetime.strptime('2023/07/01 11:00:00.000', '%Y/%m/%d %H:%M:%S.%f'),
+ activity_status='F',
+ title='test2',
+ action_order=1,
+ )
+
+ # 3. Restricted Access is approved.
+ rec_id13 = 13
+ rec_id13_1 = 13.1
+ rec_uuid13 = uuid.uuid4()
+ rec_uuid13_1 = uuid.uuid4()
+ recid13 = PersistentIdentifier.create('recid', str(rec_id13), object_type='rec', object_uuid=rec_uuid13, status=PIDStatus.REGISTERED,)
+ recid13_1 = PersistentIdentifier.create('recid', str(rec_id13_1), object_type='rec', object_uuid=rec_uuid13_1, status=PIDStatus.REGISTERED,)
+ depid13 = PersistentIdentifier.create('depid', str(rec_id13), object_type='rec', object_uuid=rec_uuid13, status=PIDStatus.REGISTERED,)
+ depid13_1 = PersistentIdentifier.create('depid', str(rec_id13_1), object_type='rec', object_uuid=rec_uuid13_1, status=PIDStatus.REGISTERED,)
+ parent13 = PersistentIdentifier.create('parent', f'parent:{rec_id13}', object_type='rec', object_uuid=rec_uuid13, status=PIDStatus.REGISTERED,)
+ rel13 = PIDRelation.create(parent13, recid13, 2, 0)
+ rel13_1 = PIDRelation.create(parent13, recid13_1, 2, 1)
+ dep_rel13 = PIDRelation.create(recid13, depid13, 3)
+ dep_rel13_1 = PIDRelation.create(recid13_1, depid13_1, 3)
+ record13 = WekoRecord.create(record_data_list[2], id_=rec_uuid13)
+
+ activity13 = Activity(
+ activity_id='13',
+ item_id=rec_uuid13_1,
+ workflow_id=1,
+ flow_id=workflows['flow_define'].id,
+ activity_start=datetime.strptime('2023/07/01 10:00:00.000', '%Y/%m/%d %H:%M:%S.%f'),
+ activity_end=datetime.strptime('2023/07/01 11:00:00.000', '%Y/%m/%d %H:%M:%S.%f'),
+ activity_status='F',
+ title='test3',
+ action_order=1,
+ )
+
+ file_permission13 = FilePermission(
+ user_id=users[0]['id'],
+ record_id=rec_id13,
+ file_name='dummy.txt',
+ usage_application_activity_id='13',
+ usage_report_activity_id=None,
+ status=1, # Approved
+ )
+ file13_onetime = FileOnetimeDownload(
+ user_mail=users[0]['email'],
+ record_id=rec_id13,
+ file_name='dummy.txt',
+ download_count=1,
+ expiration_date=1,
+ )
+
+ # 4. Restricted Access is not approved.
+ rec_id14 = 14
+ rec_id14_1 = 14.1
+ rec_uuid14 = uuid.uuid4()
+ rec_uuid14_1 = uuid.uuid4()
+ recid14 = PersistentIdentifier.create('recid', str(rec_id14), object_type='rec', object_uuid=rec_uuid14, status=PIDStatus.REGISTERED,)
+ recid14_1 = PersistentIdentifier.create('recid', str(rec_id14_1), object_type='rec', object_uuid=rec_uuid14_1, status=PIDStatus.REGISTERED,)
+ depid14 = PersistentIdentifier.create('depid', str(rec_id14), object_type='rec', object_uuid=rec_uuid14, status=PIDStatus.REGISTERED,)
+ depid14_1 = PersistentIdentifier.create('depid', str(rec_id14_1), object_type='rec', object_uuid=rec_uuid14_1, status=PIDStatus.REGISTERED,)
+ parent14 = PersistentIdentifier.create('parent', f'parent:{rec_id14}', object_type='rec', object_uuid=rec_uuid14, status=PIDStatus.REGISTERED,)
+ rel14 = PIDRelation.create(parent14, recid14, 2, 0)
+ rel14_1 = PIDRelation.create(parent14, recid14_1, 2, 1)
+ dep_rel14 = PIDRelation.create(recid14, depid14, 3)
+ dep_rel14_1 = PIDRelation.create(recid14_1, depid14_1, 3)
+ record14 = WekoRecord.create(record_data_list[3], id_=rec_uuid14)
+
+ activity14 = Activity(
+ activity_id='14',
+ item_id=rec_uuid14_1,
+ workflow_id=1,
+ flow_id=workflows['flow_define'].id,
+ activity_start=datetime.strptime('2023/07/01 10:00:00.000', '%Y/%m/%d %H:%M:%S.%f'),
+ activity_end=datetime.strptime('2023/07/01 11:00:00.000', '%Y/%m/%d %H:%M:%S.%f'),
+ activity_status='F',
+ title='test4',
+ action_order=1,
+ )
+
+ file_permission14 = FilePermission(
+ user_id=users[0]['id'],
+ record_id=rec_id14,
+ file_name='dummy.txt',
+ usage_application_activity_id='14',
+ usage_report_activity_id=None,
+ status=0, # Processing
+ )
+
+ # 5. Restricted Access is not applied.
+ rec_id15 = 15
+ rec_id15_1 = 15.1
+ rec_uuid15 = uuid.uuid4()
+ rec_uuid15_1 = uuid.uuid4()
+ recid15 = PersistentIdentifier.create('recid', str(rec_id15), object_type='rec', object_uuid=rec_uuid15, status=PIDStatus.REGISTERED,)
+ recid15_1 = PersistentIdentifier.create('recid', str(rec_id15_1), object_type='rec', object_uuid=rec_uuid15_1, status=PIDStatus.REGISTERED,)
+ parent15 = PersistentIdentifier.create('parent', f'parent:{rec_id15}', object_type='rec', object_uuid=rec_uuid15, status=PIDStatus.REGISTERED,)
+ depid15 = PersistentIdentifier.create('depid', str(rec_id15), object_type='rec', object_uuid=rec_uuid15, status=PIDStatus.REGISTERED,)
+ depid15_1 = PersistentIdentifier.create('depid', str(rec_id15_1), object_type='rec', object_uuid=rec_uuid15_1, status=PIDStatus.REGISTERED,)
+ rel15 = PIDRelation.create(parent15, recid15, 2, 0)
+ rel15_1 = PIDRelation.create(parent15, recid15_1, 2, 1)
+ dep_rel15 = PIDRelation.create(recid15, depid15, 3)
+ dep_rel15_1 = PIDRelation.create(recid15_1, depid15_1, 3)
+ record15 = WekoRecord.create(record_data_list[4], id_=rec_uuid15)
+
+ activity15 = Activity(
+ activity_id='15',
+ item_id=rec_uuid15_1,
+ workflow_id=1,
+ flow_id=workflows['flow_define'].id,
+ activity_start=datetime.strptime('2023/07/01 10:00:00.000', '%Y/%m/%d %H:%M:%S.%f'),
+ activity_end=datetime.strptime('2023/07/01 11:00:00.000', '%Y/%m/%d %H:%M:%S.%f'),
+ activity_status='F',
+ title='test5',
+ action_order=1,
+ )
+
+ # 6. Activity is not completed.
+ rec_id16 = 16
+ rec_id16_1 = 16.1
+ rec_uuid16 = uuid.uuid4()
+ rec_uuid16_1 = uuid.uuid4()
+ recid16 = PersistentIdentifier.create('recid', str(rec_id16), object_type='rec', object_uuid=rec_uuid16, status=PIDStatus.REGISTERED,)
+ recid16_1 = PersistentIdentifier.create('recid', str(rec_id16_1), object_type='rec', object_uuid=rec_uuid16_1, status=PIDStatus.REGISTERED,)
+ depid16 = PersistentIdentifier.create('depid', str(rec_id16), object_type='rec', object_uuid=rec_uuid16, status=PIDStatus.REGISTERED,)
+ depid16_1 = PersistentIdentifier.create('depid', str(rec_id16_1), object_type='rec', object_uuid=rec_uuid16_1, status=PIDStatus.REGISTERED,)
+ parent16 = PersistentIdentifier.create('parent', f'parent:{rec_id16}', object_type='rec', object_uuid=rec_uuid16, status=PIDStatus.REGISTERED,)
+ rel16 = PIDRelation.create(parent16, recid16, 2, 0)
+ rel16_1 = PIDRelation.create(parent16, recid16_1, 2, 1)
+ dep_rel16 = PIDRelation.create(recid15, depid16, 3)
+ dep_rel16_1 = PIDRelation.create(recid15_1, depid16_1, 3)
+ record16 = WekoRecord.create(record_data_list[5], id_=rec_uuid16)
+
+ activity16 = Activity(
+ activity_id='16',
+ item_id=rec_uuid16_1,
+ workflow_id=1,
+ flow_id=workflows['flow_define'].id,
+ activity_start=datetime.strptime('2023/07/01 10:00:00.000', '%Y/%m/%d %H:%M:%S.%f'),
+ activity_end=datetime.strptime('2023/07/01 11:00:00.000', '%Y/%m/%d %H:%M:%S.%f'),
+ activity_status='C',
+ title='test6',
+ action_order=1,
+ )
+
+ guest_activity_12 = GuestActivity(
+ user_mail="guest@example.org",
+ record_id=12,
+ file_name="dummy.txt",
+ activity_id="A-00000000-1234",
+ token='',
+ expiration_date=datetime.now()
+ )
+
+ with db.session.begin_nested():
+ db.session.add(activity11)
+ db.session.add(activity12)
+ db.session.add(activity13)
+ db.session.add(file_permission13)
+ db.session.add(file13_onetime)
+ db.session.add(activity14)
+ db.session.add(file_permission14)
+ db.session.add(activity15)
+ db.session.add(activity16)
+ db.session.add(guest_activity_12)
+ db.session.commit()
+
+ return {
+ 'FileOnetimeDownload': {'13': file13_onetime},
+ }
+
+
+@pytest.fixture()
+def client_oauth(users):
+ """Create client."""
+ # create resource_owner -> client_1
+ client_ = Client(
+ client_id='client_test_u1c1',
+ client_secret='client_test_u1c1',
+ name='client_test_u1c1',
+ description='',
+ is_confidential=False,
+ user=users[2]['obj'],
+ _redirect_uris='',
+ _default_scopes='',
+ )
+ with db_.session.begin_nested():
+ db_.session.add(client_)
+ db_.session.commit()
+ return client_
+
+
+@pytest.fixture()
+def create_oauth_token(client, client_oauth, users):
+ """Create token."""
+ token1_ = Token(
+ client=client_oauth,
+ user=users[2]['obj'], # sysadmin
+ token_type='u',
+ access_token='dev_access_1',
+ refresh_token='dev_refresh_1',
+ expires=datetime.now() + timedelta(hours=10),
+ is_personal=False,
+ is_internal=True,
+ _scopes=item_read_scope.id,
+ )
+ token2_ = Token(
+ client=client_oauth,
+ user=users[0]['obj'], # contributor
+ token_type='u',
+ access_token='dev_access_2',
+ refresh_token='dev_refresh_2',
+ expires=datetime.now() + timedelta(hours=10),
+ is_personal=False,
+ is_internal=True,
+ _scopes=item_read_scope.id,
+ )
+ token3_ = Token(
+ client=client_oauth,
+ user=users[7]['obj'], # user
+ token_type='u',
+ access_token='dev_access_3',
+ refresh_token='dev_refresh_3',
+ expires=datetime.now() + timedelta(hours=10),
+ is_personal=False,
+ is_internal=True,
+ _scopes=item_read_scope.id,
+ )
+ with db_.session.begin_nested():
+ db_.session.add(token1_)
+ db_.session.add(token2_)
+ db_.session.add(token3_)
+ db_.session.commit()
+ return [token1_, token2_, token3_]
+
+@pytest.fixture()
+def create_oauth_token_activity_scope(client, client_oauth, users):
+ """Create token."""
+ token1_ = Token(
+ client=client_oauth,
+ user=users[2]['obj'], # sysadmin
+ token_type='u',
+ access_token='dev_access_activity_scope_1',
+ refresh_token='dev_refresh_activity_scope_1',
+ expires=datetime.now() + timedelta(hours=10),
+ is_personal=False,
+ is_internal=True,
+ _scopes=activity_scope.id,
+ )
+ token2_ = Token(
+ client=client_oauth,
+ user=users[0]['obj'], # contributor
+ token_type='u',
+ access_token='dev_access_activity_scope_2',
+ refresh_token='dev_refresh_activity_scope_2',
+ expires=datetime.now() + timedelta(hours=10),
+ is_personal=False,
+ is_internal=True,
+ _scopes=activity_scope.id,
+ )
+ token3_ = Token(
+ client=client_oauth,
+ user=users[7]['obj'], # user
+ token_type='u',
+ access_token='dev_access_activity_scope_3',
+ refresh_token='dev_refresh_activity_scope_3',
+ expires=datetime.now() + timedelta(hours=10),
+ is_personal=False,
+ is_internal=True,
+ _scopes=activity_scope.id,
+ )
+ with db_.session.begin_nested():
+ db_.session.add(token1_)
+ db_.session.add(token2_)
+ db_.session.add(token3_)
+ db_.session.commit()
+ return [token1_, token2_, token3_]
+
+
+@pytest.fixture()
+def json_headers():
+ """JSON headers."""
+ return [('Content-Type', 'application/json'), ('Accept', 'application/json')]
+
+
+@pytest.fixture()
+def oauth_headers(client, json_headers, create_oauth_token, create_oauth_token_activity_scope):
+ """Authentication headers (with a valid oauth2 token).
+
+ It uses the token associated with the first user.
+ """
+ return [
+ fill_oauth2_headers(json_headers, create_oauth_token[0]), # sysadmin (item_read_scope)
+ fill_oauth2_headers(json_headers, create_oauth_token[1]), # contributor (item_read_scope)
+ fill_oauth2_headers(json_headers, create_oauth_token[2]), # user (item_read_scope)
+ json_headers, # not login
+ fill_oauth2_headers(json_headers, create_oauth_token_activity_scope[0]), # sysadmin (activity_scope)
+ fill_oauth2_headers(json_headers, create_oauth_token_activity_scope[1]), # contributor (activity_scope)
+ fill_oauth2_headers(json_headers, create_oauth_token_activity_scope[2]), # user (activity_scope)
+ ]
+
+@pytest.fixture()
+def make_request_maillist(db):
+ rec_id_1 = 100
+ rec_id_2 = 200
+ item_id_1 = uuid.uuid4()
+ item_id_2 = uuid.uuid4()
+ mail_list_1 = [{"email": "author1@example.com", "author_id": "1"}]
+ mail_list_2 = []
+
+ request_maillist_1 = RequestMailList(id = 1, item_id = item_id_1, mail_list = mail_list_1)
+ request_maillist_2 = RequestMailList(id = 2, item_id = item_id_2, mail_list = mail_list_2)
+
+ recid1_test = PersistentIdentifier.create('recid', str(rec_id_1), object_type='rec', object_uuid=item_id_1, status=PIDStatus.REGISTERED)
+ recid2_test = PersistentIdentifier.create('recid', str(rec_id_2), object_type='rec', object_uuid=item_id_2, status=PIDStatus.REGISTERED)
+
+ with db.session.begin_nested():
+ db.session.add(request_maillist_1)
+ db.session.add(request_maillist_2)
+ db.session.add(recid1_test)
+ db.session.add(recid2_test)
+ db.session.commit()
+
+ return [
+ item_id_1,
+ item_id_2
+ ]
diff --git a/modules/weko-records-ui/tests/data/comb_pdfs/CV_20230711_helloworld.pdf.pdf b/modules/weko-records-ui/tests/data/comb_pdfs/CV_20230711_helloworld.pdf.pdf
new file mode 100644
index 0000000000..611f60159a
Binary files /dev/null and b/modules/weko-records-ui/tests/data/comb_pdfs/CV_20230711_helloworld.pdf.pdf differ
diff --git a/modules/weko-records-ui/tests/data/comb_pdfs/CV_20230719_helloworld.pdf.pdf b/modules/weko-records-ui/tests/data/comb_pdfs/CV_20230719_helloworld.pdf.pdf
new file mode 100644
index 0000000000..611f60159a
Binary files /dev/null and b/modules/weko-records-ui/tests/data/comb_pdfs/CV_20230719_helloworld.pdf.pdf differ
diff --git a/modules/weko-records-ui/tests/data/itemtype_form_31001.json b/modules/weko-records-ui/tests/data/itemtype_form_31001.json
new file mode 100644
index 0000000000..bfc80c08fd
--- /dev/null
+++ b/modules/weko-records-ui/tests/data/itemtype_form_31001.json
@@ -0,0 +1 @@
+[{"key": "pubdate", "type": "template", "title": "PubDate", "format": "yyyy-MM-dd", "required": true, "title_i18n": {"en": "PubDate", "ja": "公開日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html"}, {"key": "item_1616221831877", "type": "fieldset", "items": [{"key": "item_1616221831877.subitem_restricted_access_dataset_usage", "type": "text", "title": "Dataset Usage", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}, "title_i18n_temp": {"en": "Dataset Usage", "ja": "データ名"}}], "title": "Dataset Usage", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}}, {"key": "item_1616221851421", "type": "fieldset", "items": [{"key": "item_1616221851421.subitem_restricted_access_name", "type": "text", "title": "Name", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, {"key": "item_1616221851421.subitem_restricted_access_mail_address", "type": "text", "title": "Mail Address", "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, {"key": "item_1616221851421.subitem_restricted_access_university/institution", "type": "text", "title": "University/Institution", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, {"key": "item_1616221851421.subitem_restricted_access_affiliated_division/department", "type": "text", "title": "Affiliated Division/Department", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}, {"key": "item_1616221851421.subitem_restricted_access_position", "type": "select", "title": "Position", "titleMap": [], "htmlClass": "cls-position", "title_i18n": {"en": "Position", "ja": "役職"}, "title_i18n_temp": {"en": "Position", "ja": "役職"}}, {"key": "item_1616221851421.subitem_restricted_access_position(others)", "type": "text", "title": "Position(Others)", "htmlClass": "cls-position-others", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, {"key": "item_1616221851421.subitem_restricted_access_phone_number", "type": "text", "title": "Phone Number", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}], "title": "Applicant", "title_i18n": {"en": "Applicant", "ja": "申請者"}}, {"add": "New", "key": "item_1616221894659", "items": [{"key": "item_1616221894659[].subitem_restricted_access_institution_name", "type": "text", "title": "Institution Name", "title_i18n": {"en": "Institution Name", "ja": "所属学会名"}, "title_i18n_temp": {"en": "Institution Name", "ja": "所属学会名"}}, {"key": "item_1616221894659[].subitem_restricted_access_institution_position", "type": "select", "title": "Institution Position", "titleMap": [], "title_i18n": {"en": "Institution Position", "ja": "所属学会役職"}, "title_i18n_temp": {"en": "Institution Position", "ja": "所属学会役職"}}], "style": {"add": "btn-success"}, "title": "Applicant Affiliated Institution", "title_i18n": {"en": "Applicant Affiliated Institution", "ja": "申請者所属学会"}}, {"key": "item_1616221921931", "type": "fieldset", "items": [{"key": "item_1616221921931.subitem_restricted_access_usage_report_id", "type": "text", "title": "Usage Report ID", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID "}, "title_i18n_temp": {"en": "Usage Report ID", "ja": "利用報告ID "}}], "title": "Usage Report ID", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID"}}, {"key": "item_1616221941275", "type": "fieldset", "items": [{"key": "item_1616221941275.subitem_restricted_access_research_title", "type": "text", "title": "Research Title", "title_i18n": {"en": "Research Title", "ja": "研究題目"}, "title_i18n_temp": {"en": "Research Title", "ja": "研究題目"}}], "title": "Research Title", "title_i18n": {"en": "Research Title", "ja": "研究題目"}}, {"key": "item_1616221960771", "type": "fieldset", "items": [{"key": "item_1616221960771.subitem_restricted_access_research_plan", "type": "textarea", "title": "Research Plan", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}, "title_i18n_temp": {"en": "Research Plan", "ja": "研究計画"}}, {"key": "item_1616221960771.subitem_restricted_access_research_plan_type", "type": "select", "title": "Research Plan Type", "readonly": true, "titleMap": [{"name": "Abstract", "value": "Abstract"}], "htmlClass": "hide", "title_i18n": {"en": "Research Plan Type", "ja": "研究計画タイプ"}, "title_i18n_temp": {"en": "Research Plan Type", "ja": "研究計画タイプ"}}], "title": "Research Plan", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}}, {"add": "New", "key": "item_1616221987611", "items": [{"key": "item_1616221987611[].filename", "type": "template", "title": "表示名", "onChange": "fileNameSelect(this, form, modelValue)", "titleMap": [], "title_i18n": {"en": "FileName", "ja": "表示名"}, "templateUrl": "/static/templates/weko_deposit/datalist.html", "fieldHtmlClass": "file-name", "title_i18n_temp": {"en": "FileName", "ja": "表示名"}}, {"key": "item_1616221987611[].url", "type": "fieldset", "items": [{"key": "item_1616221987611[].url.url", "type": "text", "title": "本文URL", "feedback": false, "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "fieldHtmlClass": "file-text-url", "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}, "disableSuccessState": true}, {"key": "item_1616221987611[].url.label", "type": "text", "title": "ラベル", "feedback": false, "title_i18n": {"en": "Label", "ja": "ラベル"}, "title_i18n_temp": {"en": "Label", "ja": "ラベル"}, "disableSuccessState": true}, {"key": "item_1616221987611[].url.objectType", "type": "select", "title": "オブジェクトタイプ", "feedback": false, "titleMap": [{"name": "abstract", "value": "abstract", "name_i18n": {"en": "abstract", "ja": "abstract"}}, {"name": "dataset", "value": "dataset", "name_i18n": {"en": "dataset", "ja": "dataset"}}, {"name": "fulltext", "value": "fulltext", "name_i18n": {"en": "fulltext", "ja": "fulltext"}}, {"name": "software", "value": "software", "name_i18n": {"en": "software", "ja": "software"}}, {"name": "summary", "value": "summary", "name_i18n": {"en": "summary", "ja": "summary"}}, {"name": "thumbnail", "value": "thumbnail", "name_i18n": {"en": "thumbnail", "ja": "thumbnail"}}, {"name": "other", "value": "other", "name_i18n": {"en": "other", "ja": "other"}}], "title_i18n": {"en": "Object Type", "ja": "オブジェクトタイプ"}, "title_i18n_temp": {"en": "Object Type", "ja": "オブジェクトタイプ"}, "disableSuccessState": true}], "title": "本文URL", "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}}, {"key": "item_1616221987611[].format", "type": "text", "title": "フォーマット", "title_i18n": {"en": "Format", "ja": "フォーマット"}, "title_i18n_temp": {"en": "Format", "ja": "フォーマット"}}, {"add": "New", "key": "item_1616221987611[].filesize", "items": [{"key": "item_1616221987611[].filesize[].value", "type": "text", "title": "サイズ", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}], "style": {"add": "btn-success"}, "title": "サイズ", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}, {"add": "New", "key": "item_1616221987611[].fileDate", "items": [{"key": "item_1616221987611[].fileDate[].fileDateType", "type": "select", "title": "日付タイプ", "titleMap": [{"name": "Accepted", "value": "Accepted"}, {"name": "Collected", "value": "Collected"}, {"name": "Copyrighted", "value": "Copyrighted"}, {"name": "Issued", "value": "Issued"}, {"name": "Submitted", "value": "Submitted"}, {"name": "Updated", "value": "Updated"}, {"name": "Valid", "value": "Valid"}], "title_i18n": {"en": "Date Type", "ja": "日付タイプ"}, "title_i18n_temp": {"en": "Date Type", "ja": "日付タイプ"}}, {"key": "item_1616221987611[].fileDate[].fileDateValue", "type": "template", "title": "日付", "format": "yyyy-MM-dd", "title_i18n": {"en": "Date", "ja": "日付"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "Date", "ja": "日付"}}], "style": {"add": "btn-success"}, "title": "日付", "title_i18n": {"en": "Date", "ja": "日付"}, "title_i18n_temp": {"en": "Date", "ja": "日付"}}, {"key": "item_1616221987611[].version", "type": "text", "title": "バージョン情報", "title_i18n": {"en": "Version Information", "ja": "バージョン情報"}, "title_i18n_temp": {"en": "Version Information", "ja": "バージョン情報"}}, {"key": "item_1616221987611[].displaytype", "type": "select", "title": "表示形式", "titleMap": [{"name": "詳細表示", "value": "detail", "name_i18n": {"en": "Detail", "ja": "詳細表示"}}, {"name": "簡易表示", "value": "simple", "name_i18n": {"en": "Simple", "ja": "簡易表示"}}, {"name": "プレビュー", "value": "preview", "name_i18n": {"en": "Preview", "ja": "プレビュー"}}], "title_i18n": {"en": "Preview", "ja": "表示形式"}, "title_i18n_temp": {"en": "Preview", "ja": "表示形式"}}, {"key": "item_1616221987611[].licensetype", "type": "select", "title": "ライセンス", "titleMap": [], "title_i18n": {"en": "License", "ja": "ライセンス"}, "title_i18n_temp": {"en": "License", "ja": "ライセンス"}}, {"key": "item_1616221987611[].licensefree", "type": "textarea", "notitle": true, "condition": "model.item_1616221987611[arrayIndex].licensetype == 'license_free'", "title_i18n": {"en": "自由ライセンス", "ja": "自由ライセンス"}}, {"type": "template", "title": "剽窃チェック", "template": "", "title_i18n": {"en": "Check Plagiarism", "ja": "剽窃チェック"}}, {"key": "item_1616221987611[].accessrole", "type": "radios", "title": "アクセス", "titleMap": [{"name": "オープンアクセス", "value": "open_access", "name_i18n": {"en": "Open access", "ja": "オープンアクセス"}}, {"name": "オープンアクセス日を指定する", "value": "open_date", "name_i18n": {"en": "Input Open Access Date", "ja": "オープンアクセス日を指定する"}}, {"name": "ログインユーザのみ", "value": "open_login", "name_i18n": {"en": "Registered User Only", "ja": "ログインユーザのみ"}}, {"name": "公開しない", "value": "open_no", "name_i18n": {"en": "Do not Publish", "ja": "公開しない"}}], "title_i18n": {"en": "Access", "ja": "アクセス"}, "title_i18n_temp": {"en": "Access", "ja": "アクセス"}}, {"key": "item_1616221987611[].date[0].dateValue", "type": "template", "title": "公開日", "format": "yyyy-MM-dd", "condition": "model.item_1616221987611[arrayIndex].accessrole == 'open_date'", "title_i18n": {"en": "Opendate", "ja": "公開日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html"}, {"key": "item_1616221987611[].groups", "type": "select", "title": "グループ", "titleMap": [], "condition": "model.item_1616221987611[arrayIndex].accessrole == 'open_login'", "title_i18n": {"en": "Group", "ja": "グループ"}, "title_i18n_temp": {"en": "Group", "ja": "グループ"}}], "style": {"add": "btn-success"}, "title": "Co-user List", "title_i18n": {"en": "Co-user List", "ja": "共同利用者リスト"}}, {"key": "item_1616222047122", "type": "fieldset", "items": [{"key": "item_1616222047122.subitem_restricted_access_wf_issued_date", "type": "template", "title": "WF Issued Date", "format": "yyyy-MM-dd", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "WF Issued Date", "ja": "WF起票日"}}, {"key": "item_1616222047122.subitem_restricted_access_wf_issued_date_type", "type": "select", "title": "WF Issued Date Type", "readonly": true, "titleMap": [{"name": "Created", "value": "Created"}], "htmlClass": "hide", "title_i18n": {"en": "WF Issued Date Type", "ja": "WF起票日タイプ"}, "title_i18n_temp": {"en": "WF Issued Date Type", "ja": "WF起票日タイプ"}}], "title": "WF Issued Date", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}}, {"key": "item_1616222067301", "type": "fieldset", "items": [{"key": "item_1616222067301.subitem_restricted_access_application_date", "type": "template", "title": "Application Date", "format": "yyyy-MM-dd", "title_i18n": {"en": "Application Date", "ja": "申請日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "Application Date", "ja": "申請日"}}, {"key": "item_1616222067301.subitem_restricted_access_application_date_type", "type": "select", "title": "Application Date Type", "readonly": true, "titleMap": [{"name": "Issued", "value": "Issued"}], "htmlClass": "hide", "title_i18n": {"en": "Application Date Type", "ja": "申請日タイプ"}, "title_i18n_temp": {"en": "Application Date Type", "ja": "申請日タイプ"}}], "title": "Application Date", "title_i18n": {"en": "Application Date", "ja": "申請日"}}, {"key": "item_1616222093486", "type": "fieldset", "items": [{"key": "item_1616222093486.subitem_restricted_access_approval_date", "type": "template", "title": "Approval Date", "format": "yyyy-MM-dd", "title_i18n": {"en": "Approval Date", "ja": "承認日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "Approval Date", "ja": "承認日"}}, {"key": "item_1616222093486.subitem_restricted_access_approval_date_type", "type": "select", "title": "Approval Date Type", "readonly": true, "titleMap": [{"name": "Accepted", "value": "Accepted"}], "htmlClass": "hide", "title_i18n": {"en": "Approval Date Type", "ja": "承認日タイプ "}, "title_i18n_temp": {"en": "Approval Date Type", "ja": "承認日タイプ"}}], "title": "Approval Date", "title_i18n": {"en": "Approval Date", "ja": "承認日"}}, {"key": "item_1616222117209", "type": "fieldset", "items": [{"key": "item_1616222117209.subitem_restricted_access_item_title", "type": "text", "title": "Item Title", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}, "title_i18n_temp": {"en": "Item Title", "ja": "アイテムタイトル"}}], "title": "Item Title", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}}, {"key": "system_identifier_doi", "type": "fieldset", "items": [{"key": "parentkey.subitem_systemidt_identifier", "type": "text", "title": "SYSTEMIDT Identifier"}, {"key": "parentkey.subitem_systemidt_identifier_type", "type": "select", "title": "SYSTEMIDT Identifier Type", "titleMap": [{"name": "DOI", "value": "DOI"}, {"name": "HDL", "value": "HDL"}, {"name": "URI", "value": "URI"}]}], "title": "Persistent Identifier(DOI)", "title_i18n": {"en": "Persistent Identifier(DOI)", "ja": "永続識別子(DOI)"}}, {"key": "system_identifier_hdl", "type": "fieldset", "items": [{"key": "parentkey.subitem_systemidt_identifier", "type": "text", "title": "SYSTEMIDT Identifier"}, {"key": "parentkey.subitem_systemidt_identifier_type", "type": "select", "title": "SYSTEMIDT Identifier Type", "titleMap": [{"name": "DOI", "value": "DOI"}, {"name": "HDL", "value": "HDL"}, {"name": "URI", "value": "URI"}]}], "title": "Persistent Identifier(HDL)", "title_i18n": {"en": "Persistent Identifier(HDL)", "ja": "永続識別子(HDL)"}}, {"key": "system_identifier_uri", "type": "fieldset", "items": [{"key": "parentkey.subitem_systemidt_identifier", "type": "text", "title": "SYSTEMIDT Identifier"}, {"key": "parentkey.subitem_systemidt_identifier_type", "type": "select", "title": "SYSTEMIDT Identifier Type", "titleMap": [{"name": "DOI", "value": "DOI"}, {"name": "HDL", "value": "HDL"}, {"name": "URI", "value": "URI"}]}], "title": "Persistent Identifier(URI)", "title_i18n": {"en": "Persistent Identifier(URI)", "ja": "永続識別子(URI)"}}, {"key": "system_file", "type": "fieldset", "items": [{"add": "New", "key": "parentkey.subitem_systemfile_filename", "items": [{"key": "parentkey.subitem_systemfile_filename[].subitem_systemfile_filename_label", "type": "text", "title": "SYSTEMFILE Filename Label"}, {"key": "parentkey.subitem_systemfile_filename[].subitem_systemfile_filename_type", "type": "select", "title": "SYSTEMFILE Filename Type", "titleMap": [{"name": "Abstract", "value": "Abstract"}, {"name": "Fulltext", "value": "Fulltext"}, {"name": "Summary", "value": "Summary"}, {"name": "Thumbnail", "value": "Thumbnail"}, {"name": "Other", "value": "Other"}]}, {"key": "parentkey.subitem_systemfile_filename[].subitem_systemfile_filename_uri", "type": "text", "title": "SYSTEMFILE Filename URI"}], "style": {"add": "btn-success"}, "title": "SYSTEMFILE Filename"}, {"key": "parentkey.subitem_systemfile_mimetype", "type": "text", "title": "SYSTEMFILE MimeType"}, {"key": "parentkey.subitem_systemfile_size", "type": "text", "title": "SYSTEMFILE Size"}, {"add": "New", "key": "parentkey.subitem_systemfile_datetime", "items": [{"key": "parentkey.subitem_systemfile_datetime[].subitem_systemfile_datetime_date", "type": "template", "title": "SYSTEMFILE DateTime Date", "format": "yyyy-MM-dd", "templateUrl": "/static/templates/weko_deposit/datepicker.html"}, {"key": "parentkey.subitem_systemfile_datetime[].subitem_systemfile_datetime_type", "type": "select", "title": "SYSTEMFILE DateTime Type", "titleMap": [{"name": "Accepted", "value": "Accepted"}, {"name": "Available", "value": "Available"}, {"name": "Collected", "value": "Collected"}, {"name": "Copyrighted", "value": "Copyrighted"}, {"name": "Created", "value": "Created"}, {"name": "Issued", "value": "Issued"}, {"name": "Submitted", "value": "Submitted"}, {"name": "Updated", "value": "Updated"}, {"name": "Valid", "value": "Valid"}]}], "style": {"add": "btn-success"}, "title": "SYSTEMFILE DateTime"}, {"key": "parentkey.subitem_systemfile_version", "type": "text", "title": "SYSTEMFILE Version"}], "title": "File Information", "title_i18n": {"en": "File Information", "ja": "ファイル情報"}}]
\ No newline at end of file
diff --git a/modules/weko-records-ui/tests/data/itemtype_form_31002.json b/modules/weko-records-ui/tests/data/itemtype_form_31002.json
new file mode 100644
index 0000000000..dfb9ee6f59
--- /dev/null
+++ b/modules/weko-records-ui/tests/data/itemtype_form_31002.json
@@ -0,0 +1 @@
+[{"key": "pubdate", "type": "template", "title": "PubDate", "format": "yyyy-MM-dd", "required": true, "title_i18n": {"en": "PubDate", "ja": "公開日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html"}, {"key": "item_1616221831877", "type": "fieldset", "items": [{"key": "item_1616221831877.subitem_restricted_access_dataset_usage", "type": "text", "title": "Dataset Usage", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}, "title_i18n_temp": {"en": "Dataset Usage", "ja": "データ名"}}], "title": "Dataset Usage", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}}, {"key": "item_1616221851421", "type": "fieldset", "items": [{"key": "item_1616221851421.subitem_restricted_access_name", "type": "text", "title": "Name", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, {"key": "item_1616221851421.subitem_restricted_access_mail_address", "type": "text", "title": "Mail Address", "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, {"key": "item_1616221851421.subitem_restricted_access_university/institution", "type": "text", "title": "University/Institution", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, {"key": "item_1616221851421.subitem_restricted_access_affiliated_division/department", "type": "text", "title": "Affiliated Division/Department", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}, {"key": "item_1616221851421.subitem_restricted_access_position", "type": "select", "title": "Position", "titleMap": [], "htmlClass": "cls-position", "title_i18n": {"en": "Position", "ja": "役職"}, "title_i18n_temp": {"en": "Position", "ja": "役職"}}, {"key": "item_1616221851421.subitem_restricted_access_position(others)", "type": "text", "title": "Position(Others)", "htmlClass": "cls-position-others", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, {"key": "item_1616221851421.subitem_restricted_access_phone_number", "type": "text", "title": "Phone Number", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}], "title": "Applicant", "title_i18n": {"en": "Applicant", "ja": "申請者"}}, {"add": "New", "key": "item_1616221894659", "items": [{"key": "item_1616221894659[].subitem_restricted_access_institution_name", "type": "text", "title": "Institution Name", "title_i18n": {"en": "Institution Name", "ja": "所属学会名"}, "title_i18n_temp": {"en": "Institution Name", "ja": "所属学会名"}}, {"key": "item_1616221894659[].subitem_restricted_access_institution_position", "type": "select", "title": "Institution Position", "titleMap": [], "title_i18n": {"en": "Institution Position", "ja": "所属学会役職"}, "title_i18n_temp": {"en": "Institution Position", "ja": "所属学会役職"}}], "style": {"add": "btn-success"}, "title": "Applicant Affiliated Institution", "title_i18n": {"en": "Applicant Affiliated Institution", "ja": "申請者所属学会"}}, {"key": "item_1616221902404", "type": "fieldset", "items": [{"key": "item_1616221902404.subitem_restricted_access_guarantor_name", "type": "text", "title": "Name", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, {"key": "item_1616221902404.subitem_restricted_access_guarantor_mail_address", "type": "text", "title": "Mail Address", "approval": true, "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, {"key": "item_1616221902404.subitem_restricted_access_guarantor_university/institution", "type": "text", "title": "University/Institution", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, {"key": "item_1616221902404.subitem_restricted_access_guarantor_affiliated_division/department", "type": "text", "title": "Affiliated Division/Department", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}, {"key": "item_1616221902404.subitem_restricted_access_guarantor_position", "type": "select", "title": "Position", "titleMap": [], "htmlClass": "cls-position", "title_i18n": {"en": "Position", "ja": "役職"}, "title_i18n_temp": {"en": "Position", "ja": "役職"}}, {"key": "item_1616221902404.subitem_restricted_access_guarantor_position(others)", "type": "text", "title": "Position(Others)", "htmlClass": "cls-position-others", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, {"key": "item_1616221902404.subitem_restricted_access_guarantor_phone_number", "type": "text", "title": "Phone Number", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}], "title": "Guarantor", "title_i18n": {"en": "Guarantor", "ja": "保証人"}}, {"key": "item_1616221921931", "type": "fieldset", "items": [{"key": "item_1616221921931.subitem_restricted_access_usage_report_id", "type": "text", "title": "Usage Report ID", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID "}, "title_i18n_temp": {"en": "Usage Report ID", "ja": "利用報告ID "}}], "title": "Usage Report ID", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID"}}, {"key": "item_1616221941275", "type": "fieldset", "items": [{"key": "item_1616221941275.subitem_restricted_access_research_title", "type": "text", "title": "Research Title", "title_i18n": {"en": "Research Title", "ja": "研究題目"}, "title_i18n_temp": {"en": "Research Title", "ja": "研究題目"}}], "title": "Research Title", "title_i18n": {"en": "Research Title", "ja": "研究題目"}}, {"key": "item_1616221960771", "type": "fieldset", "items": [{"key": "item_1616221960771.subitem_restricted_access_research_plan", "type": "textarea", "title": "Research Plan", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}, "title_i18n_temp": {"en": "Research Plan", "ja": "研究計画"}}, {"key": "item_1616221960771.subitem_restricted_access_research_plan_type", "type": "select", "title": "Research Plan Type", "readonly": true, "titleMap": [{"name": "Abstract", "value": "Abstract"}], "htmlClass": "hide", "title_i18n": {"en": "Research Plan Type", "ja": "研究計画タイプ"}, "title_i18n_temp": {"en": "Research Plan Type", "ja": "研究計画タイプ"}}], "title": "Research Plan", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}}, {"add": "New", "key": "item_1616221987611", "items": [{"key": "item_1616221987611[].filename", "type": "template", "title": "表示名", "onChange": "fileNameSelect(this, form, modelValue)", "titleMap": [], "title_i18n": {"en": "FileName", "ja": "表示名"}, "templateUrl": "/static/templates/weko_deposit/datalist.html", "fieldHtmlClass": "file-name", "title_i18n_temp": {"en": "FileName", "ja": "表示名"}}, {"key": "item_1616221987611[].url", "type": "fieldset", "items": [{"key": "item_1616221987611[].url.url", "type": "text", "title": "本文URL", "feedback": false, "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "fieldHtmlClass": "file-text-url", "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}, "disableSuccessState": true}, {"key": "item_1616221987611[].url.label", "type": "text", "title": "ラベル", "feedback": false, "title_i18n": {"en": "Label", "ja": "ラベル"}, "title_i18n_temp": {"en": "Label", "ja": "ラベル"}, "disableSuccessState": true}, {"key": "item_1616221987611[].url.objectType", "type": "select", "title": "オブジェクトタイプ", "feedback": false, "titleMap": [{"name": "abstract", "value": "abstract", "name_i18n": {"en": "abstract", "ja": "abstract"}}, {"name": "dataset", "value": "dataset", "name_i18n": {"en": "dataset", "ja": "dataset"}}, {"name": "fulltext", "value": "fulltext", "name_i18n": {"en": "fulltext", "ja": "fulltext"}}, {"name": "software", "value": "software", "name_i18n": {"en": "software", "ja": "software"}}, {"name": "summary", "value": "summary", "name_i18n": {"en": "summary", "ja": "summary"}}, {"name": "thumbnail", "value": "thumbnail", "name_i18n": {"en": "thumbnail", "ja": "thumbnail"}}, {"name": "other", "value": "other", "name_i18n": {"en": "other", "ja": "other"}}], "title_i18n": {"en": "Object Type", "ja": "オブジェクトタイプ"}, "title_i18n_temp": {"en": "Object Type", "ja": "オブジェクトタイプ"}, "disableSuccessState": true}], "title": "本文URL", "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}}, {"key": "item_1616221987611[].format", "type": "text", "title": "フォーマット", "title_i18n": {"en": "Format", "ja": "フォーマット"}, "title_i18n_temp": {"en": "Format", "ja": "フォーマット"}}, {"add": "New", "key": "item_1616221987611[].filesize", "items": [{"key": "item_1616221987611[].filesize[].value", "type": "text", "title": "サイズ", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}], "style": {"add": "btn-success"}, "title": "サイズ", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}, {"add": "New", "key": "item_1616221987611[].fileDate", "items": [{"key": "item_1616221987611[].fileDate[].fileDateType", "type": "select", "title": "日付タイプ", "titleMap": [{"name": "Accepted", "value": "Accepted"}, {"name": "Collected", "value": "Collected"}, {"name": "Copyrighted", "value": "Copyrighted"}, {"name": "Issued", "value": "Issued"}, {"name": "Submitted", "value": "Submitted"}, {"name": "Updated", "value": "Updated"}, {"name": "Valid", "value": "Valid"}], "title_i18n": {"en": "Date Type", "ja": "日付タイプ"}, "title_i18n_temp": {"en": "Date Type", "ja": "日付タイプ"}}, {"key": "item_1616221987611[].fileDate[].fileDateValue", "type": "template", "title": "日付", "format": "yyyy-MM-dd", "title_i18n": {"en": "Date", "ja": "日付"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "Date", "ja": "日付"}}], "style": {"add": "btn-success"}, "title": "日付", "title_i18n": {"en": "Date", "ja": "日付"}, "title_i18n_temp": {"en": "Date", "ja": "日付"}}, {"key": "item_1616221987611[].version", "type": "text", "title": "バージョン情報", "title_i18n": {"en": "Version Information", "ja": "バージョン情報"}, "title_i18n_temp": {"en": "Version Information", "ja": "バージョン情報"}}, {"key": "item_1616221987611[].displaytype", "type": "select", "title": "表示形式", "titleMap": [{"name": "詳細表示", "value": "detail", "name_i18n": {"en": "Detail", "ja": "詳細表示"}}, {"name": "簡易表示", "value": "simple", "name_i18n": {"en": "Simple", "ja": "簡易表示"}}, {"name": "プレビュー", "value": "preview", "name_i18n": {"en": "Preview", "ja": "プレビュー"}}], "title_i18n": {"en": "Preview", "ja": "表示形式"}, "title_i18n_temp": {"en": "Preview", "ja": "表示形式"}}, {"key": "item_1616221987611[].licensetype", "type": "select", "title": "ライセンス", "titleMap": [], "title_i18n": {"en": "License", "ja": "ライセンス"}, "title_i18n_temp": {"en": "License", "ja": "ライセンス"}}, {"key": "item_1616221987611[].licensefree", "type": "textarea", "notitle": true, "condition": "model.item_1616221987611[arrayIndex].licensetype == 'license_free'", "title_i18n": {"en": "自由ライセンス", "ja": "自由ライセンス"}}, {"type": "template", "title": "剽窃チェック", "template": "", "title_i18n": {"en": "Check Plagiarism", "ja": "剽窃チェック"}}, {"key": "item_1616221987611[].accessrole", "type": "radios", "title": "アクセス", "titleMap": [{"name": "オープンアクセス", "value": "open_access", "name_i18n": {"en": "Open access", "ja": "オープンアクセス"}}, {"name": "オープンアクセス日を指定する", "value": "open_date", "name_i18n": {"en": "Input Open Access Date", "ja": "オープンアクセス日を指定する"}}, {"name": "ログインユーザのみ", "value": "open_login", "name_i18n": {"en": "Registered User Only", "ja": "ログインユーザのみ"}}, {"name": "公開しない", "value": "open_no", "name_i18n": {"en": "Do not Publish", "ja": "公開しない"}}], "title_i18n": {"en": "Access", "ja": "アクセス"}, "title_i18n_temp": {"en": "Access", "ja": "アクセス"}}, {"key": "item_1616221987611[].date[0].dateValue", "type": "template", "title": "公開日", "format": "yyyy-MM-dd", "condition": "model.item_1616221987611[arrayIndex].accessrole == 'open_date'", "title_i18n": {"en": "Opendate", "ja": "公開日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html"}, {"key": "item_1616221987611[].groups", "type": "select", "title": "グループ", "titleMap": [], "condition": "model.item_1616221987611[arrayIndex].accessrole == 'open_login'", "title_i18n": {"en": "Group", "ja": "グループ"}, "title_i18n_temp": {"en": "Group", "ja": "グループ"}}], "style": {"add": "btn-success"}, "title": "Co-user List", "title_i18n": {"en": "Co-user List", "ja": "共同利用者リスト"}}, {"key": "item_1616222047122", "type": "fieldset", "items": [{"key": "item_1616222047122.subitem_restricted_access_wf_issued_date", "type": "template", "title": "WF Issued Date", "format": "yyyy-MM-dd", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "WF Issued Date", "ja": "WF起票日"}}, {"key": "item_1616222047122.subitem_restricted_access_wf_issued_date_type", "type": "select", "title": "WF Issued Date Type", "readonly": true, "titleMap": [{"name": "Created", "value": "Created"}], "htmlClass": "hide", "title_i18n": {"en": "WF Issued Date Type", "ja": "WF起票日タイプ"}, "title_i18n_temp": {"en": "WF Issued Date Type", "ja": "WF起票日タイプ"}}], "title": "WF Issued Date", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}}, {"key": "item_1616222067301", "type": "fieldset", "items": [{"key": "item_1616222067301.subitem_restricted_access_application_date", "type": "template", "title": "Application Date", "format": "yyyy-MM-dd", "title_i18n": {"en": "Application Date", "ja": "申請日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "Application Date", "ja": "申請日"}}, {"key": "item_1616222067301.subitem_restricted_access_application_date_type", "type": "select", "title": "Application Date Type", "readonly": true, "titleMap": [{"name": "Issued", "value": "Issued"}], "htmlClass": "hide", "title_i18n": {"en": "Application Date Type", "ja": "申請日タイプ"}, "title_i18n_temp": {"en": "Application Date Type", "ja": "申請日タイプ"}}], "title": "Application Date", "title_i18n": {"en": "Application Date", "ja": "申請日"}}, {"key": "item_1616222093486", "type": "fieldset", "items": [{"key": "item_1616222093486.subitem_restricted_access_approval_date", "type": "template", "title": "Approval Date", "format": "yyyy-MM-dd", "title_i18n": {"en": "Approval Date", "ja": "承認日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "Approval Date", "ja": "承認日"}}, {"key": "item_1616222093486.subitem_restricted_access_approval_date_type", "type": "select", "title": "Approval Date Type", "readonly": true, "titleMap": [{"name": "Accepted", "value": "Accepted"}], "htmlClass": "hide", "title_i18n": {"en": "Approval Date Type", "ja": "承認日タイプ "}, "title_i18n_temp": {"en": "Approval Date Type", "ja": "承認日タイプ"}}], "title": "Approval Date", "title_i18n": {"en": "Approval Date", "ja": "承認日"}}, {"key": "item_1616222117209", "type": "fieldset", "items": [{"key": "item_1616222117209.subitem_restricted_access_item_title", "type": "text", "title": "Item Title", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}, "title_i18n_temp": {"en": "Item Title", "ja": "アイテムタイトル"}}], "title": "Item Title", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}}, {"key": "system_identifier_doi", "type": "fieldset", "items": [{"key": "parentkey.subitem_systemidt_identifier", "type": "text", "title": "SYSTEMIDT Identifier"}, {"key": "parentkey.subitem_systemidt_identifier_type", "type": "select", "title": "SYSTEMIDT Identifier Type", "titleMap": [{"name": "DOI", "value": "DOI"}, {"name": "HDL", "value": "HDL"}, {"name": "URI", "value": "URI"}]}], "title": "Persistent Identifier(DOI)", "title_i18n": {"en": "Persistent Identifier(DOI)", "ja": "永続識別子(DOI)"}}, {"key": "system_identifier_hdl", "type": "fieldset", "items": [{"key": "parentkey.subitem_systemidt_identifier", "type": "text", "title": "SYSTEMIDT Identifier"}, {"key": "parentkey.subitem_systemidt_identifier_type", "type": "select", "title": "SYSTEMIDT Identifier Type", "titleMap": [{"name": "DOI", "value": "DOI"}, {"name": "HDL", "value": "HDL"}, {"name": "URI", "value": "URI"}]}], "title": "Persistent Identifier(HDL)", "title_i18n": {"en": "Persistent Identifier(HDL)", "ja": "永続識別子(HDL)"}}, {"key": "system_identifier_uri", "type": "fieldset", "items": [{"key": "parentkey.subitem_systemidt_identifier", "type": "text", "title": "SYSTEMIDT Identifier"}, {"key": "parentkey.subitem_systemidt_identifier_type", "type": "select", "title": "SYSTEMIDT Identifier Type", "titleMap": [{"name": "DOI", "value": "DOI"}, {"name": "HDL", "value": "HDL"}, {"name": "URI", "value": "URI"}]}], "title": "Persistent Identifier(URI)", "title_i18n": {"en": "Persistent Identifier(URI)", "ja": "永続識別子(URI)"}}, {"key": "system_file", "type": "fieldset", "items": [{"add": "New", "key": "parentkey.subitem_systemfile_filename", "items": [{"key": "parentkey.subitem_systemfile_filename[].subitem_systemfile_filename_label", "type": "text", "title": "SYSTEMFILE Filename Label"}, {"key": "parentkey.subitem_systemfile_filename[].subitem_systemfile_filename_type", "type": "select", "title": "SYSTEMFILE Filename Type", "titleMap": [{"name": "Abstract", "value": "Abstract"}, {"name": "Fulltext", "value": "Fulltext"}, {"name": "Summary", "value": "Summary"}, {"name": "Thumbnail", "value": "Thumbnail"}, {"name": "Other", "value": "Other"}]}, {"key": "parentkey.subitem_systemfile_filename[].subitem_systemfile_filename_uri", "type": "text", "title": "SYSTEMFILE Filename URI"}], "style": {"add": "btn-success"}, "title": "SYSTEMFILE Filename"}, {"key": "parentkey.subitem_systemfile_mimetype", "type": "text", "title": "SYSTEMFILE MimeType"}, {"key": "parentkey.subitem_systemfile_size", "type": "text", "title": "SYSTEMFILE Size"}, {"add": "New", "key": "parentkey.subitem_systemfile_datetime", "items": [{"key": "parentkey.subitem_systemfile_datetime[].subitem_systemfile_datetime_date", "type": "template", "title": "SYSTEMFILE DateTime Date", "format": "yyyy-MM-dd", "templateUrl": "/static/templates/weko_deposit/datepicker.html"}, {"key": "parentkey.subitem_systemfile_datetime[].subitem_systemfile_datetime_type", "type": "select", "title": "SYSTEMFILE DateTime Type", "titleMap": [{"name": "Accepted", "value": "Accepted"}, {"name": "Available", "value": "Available"}, {"name": "Collected", "value": "Collected"}, {"name": "Copyrighted", "value": "Copyrighted"}, {"name": "Created", "value": "Created"}, {"name": "Issued", "value": "Issued"}, {"name": "Submitted", "value": "Submitted"}, {"name": "Updated", "value": "Updated"}, {"name": "Valid", "value": "Valid"}]}], "style": {"add": "btn-success"}, "title": "SYSTEMFILE DateTime"}, {"key": "parentkey.subitem_systemfile_version", "type": "text", "title": "SYSTEMFILE Version"}], "title": "File Information", "title_i18n": {"en": "File Information", "ja": "ファイル情報"}}]
\ No newline at end of file
diff --git a/modules/weko-records-ui/tests/data/itemtype_mapping_31001.json b/modules/weko-records-ui/tests/data/itemtype_mapping_31001.json
new file mode 100644
index 0000000000..2d0b64c4ef
--- /dev/null
+++ b/modules/weko-records-ui/tests/data/itemtype_mapping_31001.json
@@ -0,0 +1 @@
+{"pubdate": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_file": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_file": {"URI": {"@value": "subitem_systemfile_filename_uri", "@attributes": {"label": "subitem_systemfile_filename_label", "objectType": "subitem_systemfile_filename_type"}}, "date": {"@value": "subitem_systemfile_datetime_date", "@attributes": {"dateType": "subitem_systemfile_datetime_type"}}, "extent": {"@value": "subitem_systemfile_size"}, "version": {"@value": "subitem_systemfile_version"}, "mimeType": {"@value": "subitem_systemfile_mimetype"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221831877": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"title": {"@value": "subitem_restricted_access_dataset_usage"}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221851421": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"creator": {"affiliation": {"affiliationName": {"@value": "subitem_restricted_access_university/institution"}}, "creatorName": {"@value": "subitem_restricted_access_name"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221894659": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221921931": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221941275": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221960771": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"description": {"@value": "subitem_restricted_access_research_plan", "@attributes": {"descriptionType": "subitem_restricted_access_research_plan_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221987611": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222047122": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"date": {"@value": "subitem_restricted_access_wf_issued_date", "@attributes": {"dateType": "subitem_restricted_access_wf_issued_date_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222067301": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"date": {"@value": "subitem_restricted_access_application_date", "@attributes": {"dateType": "subitem_restricted_access_application_date_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222093486": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"date": {"@value": "subitem_restricted_access_approval_date", "@attributes": {"dateType": "subitem_restricted_access_approval_date_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222117209": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"alternative": {"@value": "subitem_restricted_access_item_title"}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_identifier_doi": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_identifier": {"@value": "subitem_systemidt_identifier", "@attributes": {"identifierType": "subitem_systemidt_identifier_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_identifier_hdl": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_identifier": {"@value": "subitem_systemidt_identifier", "@attributes": {"identifierType": "subitem_systemidt_identifier_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_identifier_uri": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_identifier": {"@value": "subitem_systemidt_identifier", "@attributes": {"identifierType": "subitem_systemidt_identifier_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}}
\ No newline at end of file
diff --git a/modules/weko-records-ui/tests/data/itemtype_mapping_31002.json b/modules/weko-records-ui/tests/data/itemtype_mapping_31002.json
new file mode 100644
index 0000000000..2015df878f
--- /dev/null
+++ b/modules/weko-records-ui/tests/data/itemtype_mapping_31002.json
@@ -0,0 +1 @@
+{"pubdate": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_file": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_file": {"URI": {"@value": "subitem_systemfile_filename_uri", "@attributes": {"label": "subitem_systemfile_filename_label", "objectType": "subitem_systemfile_filename_type"}}, "date": {"@value": "subitem_systemfile_datetime_date", "@attributes": {"dateType": "subitem_systemfile_datetime_type"}}, "extent": {"@value": "subitem_systemfile_size"}, "version": {"@value": "subitem_systemfile_version"}, "mimeType": {"@value": "subitem_systemfile_mimetype"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221831877": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"title": {"@value": "subitem_restricted_access_dataset_usage"}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221851421": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"creator": {"affiliation": {"affiliationName": {"@value": "subitem_restricted_access_university/institution"}}, "creatorName": {"@value": "subitem_restricted_access_name"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221894659": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221902404": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221921931": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221941275": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221960771": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"description": {"@value": "subitem_restricted_access_research_plan", "@attributes": {"descriptionType": "subitem_restricted_access_research_plan_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221987611": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222047122": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"date": {"@value": "subitem_restricted_access_wf_issued_date", "@attributes": {"dateType": "subitem_restricted_access_wf_issued_date_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222067301": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"date": {"@value": "subitem_restricted_access_application_date", "@attributes": {"dateType": "subitem_restricted_access_application_date_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222093486": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"date": {"@value": "subitem_restricted_access_approval_date", "@attributes": {"dateType": "subitem_restricted_access_approval_date_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222117209": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"alternative": {"@value": "subitem_restricted_access_item_title"}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_identifier_doi": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_identifier": {"@value": "subitem_systemidt_identifier", "@attributes": {"identifierType": "subitem_systemidt_identifier_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_identifier_hdl": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_identifier": {"@value": "subitem_systemidt_identifier", "@attributes": {"identifierType": "subitem_systemidt_identifier_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_identifier_uri": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_identifier": {"@value": "subitem_systemidt_identifier", "@attributes": {"identifierType": "subitem_systemidt_identifier_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}}
\ No newline at end of file
diff --git a/modules/weko-records-ui/tests/data/itemtype_render_31001.json b/modules/weko-records-ui/tests/data/itemtype_render_31001.json
new file mode 100644
index 0000000000..292bfda981
--- /dev/null
+++ b/modules/weko-records-ui/tests/data/itemtype_render_31001.json
@@ -0,0 +1 @@
+{"meta_fix": {"pubdate": {"title": "PubDate", "option": {"crtf": false, "hidden": false, "multiple": false, "required": true, "showlist": false}, "input_type": "datetime", "title_i18n": {"en": "PubDate", "ja": "公開日"}, "input_value": ""}}, "meta_list": {"item_1616221831877": {"title": "Dataset Usage", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30001", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616221851421": {"title": "Applicant", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30002", "title_i18n": {"en": "Applicant", "ja": "申請者"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616221894659": {"title": "Applicant Affiliated Institution", "option": {"crtf": false, "hidden": false, "multiple": true, "required": false, "showlist": false}, "input_type": "cus_30003", "title_i18n": {"en": "Applicant Affiliated Institution", "ja": "申請者所属学会"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616221921931": {"title": "Usage Report ID", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30005", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616221941275": {"title": "Research Title", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30006", "title_i18n": {"en": "Research Title", "ja": "研究題目"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616221960771": {"title": "Research Plan", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30007", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616221987611": {"title": "Co-user List", "option": {"crtf": false, "hidden": false, "multiple": true, "required": false, "showlist": false}, "input_type": "cus_30008", "title_i18n": {"en": "Co-user List", "ja": "共同利用者リスト"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616222047122": {"title": "WF Issued Date", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30011", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616222067301": {"title": "Application Date", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30012", "title_i18n": {"en": "Application Date", "ja": "申請日"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616222093486": {"title": "Approval Date", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30013", "title_i18n": {"en": "Approval Date", "ja": "承認日"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616222117209": {"title": "Item Title", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30014", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}}, "table_row": ["item_1616221831877", "item_1616221851421", "item_1616221894659", "item_1616221921931", "item_1616221941275", "item_1616221960771", "item_1616221987611", "item_1616222047122", "item_1616222067301", "item_1616222093486", "item_1616222117209"], "edit_notes": {"item_1616221831877": "", "item_1616221851421": "", "item_1616221894659": "", "item_1616221921931": "", "item_1616221941275": "", "item_1616221960771": "", "item_1616221987611": "", "item_1616222047122": "", "item_1616222067301": "", "item_1616222093486": "", "item_1616222117209": ""}, "meta_system": {"system_file": {"title": "File Information", "option": {"crtf": false, "hidden": true, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_131", "title_i18n": {"en": "File Information", "ja": "ファイル情報"}, "input_value": ""}, "system_identifier_doi": {"title": "Persistent Identifier(DOI)", "option": {"crtf": false, "hidden": true, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_130", "title_i18n": {"en": "Persistent Identifier(DOI)", "ja": "永続識別子(DOI)"}, "input_value": ""}, "system_identifier_hdl": {"title": "Persistent Identifier(HDL)", "option": {"crtf": false, "hidden": true, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_130", "title_i18n": {"en": "Persistent Identifier(HDL)", "ja": "永続識別子(HDL)"}, "input_value": ""}, "system_identifier_uri": {"title": "Persistent Identifier(URI)", "option": {"crtf": false, "hidden": true, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_130", "title_i18n": {"en": "Persistent Identifier(URI)", "ja": "永続識別子(URI)"}, "input_value": ""}}, "upload_file": false, "schemaeditor": {"schema": {"item_1616221831877": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_dataset_usage": {"type": "string", "title": "Dataset Usage", "format": "text", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}, "title_i18n_temp": {"en": "Dataset Usage", "ja": "データ名"}}}}, "item_1616221851421": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_name": {"type": "string", "title": "Name", "format": "text", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, "subitem_restricted_access_position": {"enum": [], "type": ["null", "string"], "title": "Position", "format": "select", "currentEnum": []}, "subitem_restricted_access_mail_address": {"type": "string", "title": "Mail Address", "format": "text", "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, "subitem_restricted_access_phone_number": {"type": "string", "title": "Phone Number", "format": "text", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}, "subitem_restricted_access_position(others)": {"type": "string", "title": "Position(Others)", "format": "text", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, "subitem_restricted_access_university/institution": {"type": "string", "title": "University/Institution", "format": "text", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, "subitem_restricted_access_affiliated_division/department": {"type": "string", "title": "Affiliated Division/Department", "format": "text", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}}}, "item_1616221894659": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_institution_name": {"type": "string", "title": "Institution Name", "format": "text", "title_i18n": {"en": "Institution Name", "ja": "所属学会名"}, "title_i18n_temp": {"en": "Institution Name", "ja": "所属学会名"}}, "subitem_restricted_access_institution_position": {"enum": [], "type": ["null", "string"], "title": "Institution Position", "format": "select", "currentEnum": []}}}, "item_1616221921931": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_usage_report_id": {"type": "string", "title": "Usage Report ID", "format": "text", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID "}, "title_i18n_temp": {"en": "Usage Report ID", "ja": "利用報告ID "}}}}, "item_1616221941275": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_research_title": {"type": "string", "title": "Research Title", "format": "text", "title_i18n": {"en": "Research Title", "ja": "研究題目"}, "title_i18n_temp": {"en": "Research Title", "ja": "研究題目"}}}}, "item_1616221960771": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_research_plan": {"type": "string", "title": "Research Plan", "format": "textarea", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}, "title_i18n_temp": {"en": "Research Plan", "ja": "研究計画"}}, "subitem_restricted_access_research_plan_type": {"enum": [null, "Abstract"], "type": ["null", "string"], "title": "Research Plan Type", "format": "select", "default": "Abstract", "currentEnum": ["Abstract"]}}}, "item_1616221987611": {"type": "object", "format": "object", "properties": {"url": {"type": "object", "title": "本文URL", "format": "object", "properties": {"url": {"type": "string", "title": "本文URL", "format": "text", "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}}, "label": {"type": "string", "title": "ラベル", "format": "text", "title_i18n": {"en": "Label", "ja": "ラベル"}, "title_i18n_temp": {"en": "Label", "ja": "ラベル"}}, "objectType": {"enum": [null, "abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"], "type": ["null", "string"], "title": "オブジェクトタイプ", "format": "select", "currentEnum": ["abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"]}}}, "date": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"dateType": {"enum": [], "type": ["null", "string"], "title": "日付タイプ", "format": "select", "currentEnum": []}, "dateValue": {"type": "string", "title": "日付", "format": "datetime", "title_i18n": {"en": "", "ja": ""}}}}, "title": "オープンアクセスの日付", "format": "array"}, "format": {"type": "string", "title": "フォーマット", "format": "text", "title_i18n": {"en": "Format", "ja": "フォーマット"}, "title_i18n_temp": {"en": "Format", "ja": "フォーマット"}}, "groups": {"enum": [], "type": ["null", "string"], "title": "グループ", "format": "select", "currentEnum": []}, "version": {"type": "string", "title": "バージョン情報", "format": "text", "title_i18n": {"en": "Version Information", "ja": "バージョン情報"}, "title_i18n_temp": {"en": "Version Information", "ja": "バージョン情報"}}, "fileDate": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"fileDateType": {"enum": [null, "Accepted", "Collected", "Copyrighted", "Issued", "Submitted", "Updated", "Valid"], "type": ["null", "string"], "title": "日付タイプ", "format": "select", "currentEnum": ["Accepted", "Collected", "Copyrighted", "Issued", "Submitted", "Updated", "Valid"]}, "fileDateValue": {"type": "string", "title": "日付", "format": "datetime", "title_i18n": {"en": "Date", "ja": "日付"}, "title_i18n_temp": {"en": "Date", "ja": "日付"}}}}, "title": "日付", "format": "array"}, "filename": {"enum": [], "type": ["null", "string"], "title": "表示名", "format": "text", "title_i18n": {"en": "FileName", "ja": "表示名"}, "title_i18n_temp": {"en": "FileName", "ja": "表示名"}}, "filesize": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"value": {"type": "string", "title": "サイズ", "format": "text", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}}}, "title": "サイズ", "format": "array"}, "accessrole": {"enum": ["open_access", "open_date", "open_login", "open_no"], "type": ["null", "string"], "title": "アクセス", "format": "radios"}, "displaytype": {"enum": [null, "detail", "simple", "preview"], "type": ["null", "string"], "title": "表示形式", "format": "select", "currentEnum": ["detail", "simple", "preview"]}, "licensefree": {"type": "string", "title": "自由ライセンス", "format": "textarea", "title_i18n": {"en": "自由ライセンス", "ja": "自由ライセンス"}}, "licensetype": {"enum": [], "type": ["null", "string"], "title": "ライセンス", "format": "select", "currentEnum": []}}}, "item_1616222047122": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_wf_issued_date": {"type": "string", "title": "WF Issued Date", "format": "datetime", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}, "title_i18n_temp": {"en": "WF Issued Date", "ja": "WF起票日"}}, "subitem_restricted_access_wf_issued_date_type": {"enum": [null, "Created"], "type": ["null", "string"], "title": "WF Issued Date Type", "format": "select", "default": "Created", "currentEnum": ["Created"]}}}, "item_1616222067301": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_application_date": {"type": "string", "title": "Application Date", "format": "datetime", "title_i18n": {"en": "Application Date", "ja": "申請日"}, "title_i18n_temp": {"en": "Application Date", "ja": "申請日"}}, "subitem_restricted_access_application_date_type": {"enum": [null, "Issued"], "type": ["null", "string"], "title": "Application Date Type", "format": "select", "default": "Issued", "currentEnum": ["Issued"]}}}, "item_1616222093486": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_approval_date": {"type": "string", "title": "Approval Date", "format": "datetime", "title_i18n": {"en": "Approval Date", "ja": "承認日"}, "title_i18n_temp": {"en": "Approval Date", "ja": "承認日"}}, "subitem_restricted_access_approval_date_type": {"enum": [null, "Accepted"], "type": ["null", "string"], "title": "Approval Date Type", "format": "select", "default": "Accepted", "currentEnum": ["Accepted"]}}}, "item_1616222117209": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_item_title": {"type": "string", "title": "Item Title", "format": "text", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}, "title_i18n_temp": {"en": "Item Title", "ja": "アイテムタイトル"}}}}}}, "table_row_map": {"form": [{"key": "pubdate", "type": "template", "title": "PubDate", "format": "yyyy-MM-dd", "required": true, "title_i18n": {"en": "PubDate", "ja": "公開日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html"}, {"key": "item_1616221831877", "type": "fieldset", "items": [{"key": "item_1616221831877.subitem_restricted_access_dataset_usage", "type": "text", "title": "Dataset Usage", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}, "title_i18n_temp": {"en": "Dataset Usage", "ja": "データ名"}}], "title": "Dataset Usage", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}}, {"key": "item_1616221851421", "type": "fieldset", "items": [{"key": "item_1616221851421.subitem_restricted_access_name", "type": "text", "title": "Name", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, {"key": "item_1616221851421.subitem_restricted_access_mail_address", "type": "text", "title": "Mail Address", "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, {"key": "item_1616221851421.subitem_restricted_access_university/institution", "type": "text", "title": "University/Institution", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, {"key": "item_1616221851421.subitem_restricted_access_affiliated_division/department", "type": "text", "title": "Affiliated Division/Department", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}, {"key": "item_1616221851421.subitem_restricted_access_position", "type": "select", "title": "Position", "titleMap": [], "htmlClass": "cls-position", "title_i18n": {"en": "Position", "ja": "役職"}, "title_i18n_temp": {"en": "Position", "ja": "役職"}}, {"key": "item_1616221851421.subitem_restricted_access_position(others)", "type": "text", "title": "Position(Others)", "htmlClass": "cls-position-others", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, {"key": "item_1616221851421.subitem_restricted_access_phone_number", "type": "text", "title": "Phone Number", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}], "title": "Applicant", "title_i18n": {"en": "Applicant", "ja": "申請者"}}, {"add": "New", "key": "item_1616221894659", "items": [{"key": "item_1616221894659[].subitem_restricted_access_institution_name", "type": "text", "title": "Institution Name", "title_i18n": {"en": "Institution Name", "ja": "所属学会名"}, "title_i18n_temp": {"en": "Institution Name", "ja": "所属学会名"}}, {"key": "item_1616221894659[].subitem_restricted_access_institution_position", "type": "select", "title": "Institution Position", "titleMap": [], "title_i18n": {"en": "Institution Position", "ja": "所属学会役職"}, "title_i18n_temp": {"en": "Institution Position", "ja": "所属学会役職"}}], "style": {"add": "btn-success"}, "title": "Applicant Affiliated Institution", "title_i18n": {"en": "Applicant Affiliated Institution", "ja": "申請者所属学会"}}, {"key": "item_1616221921931", "type": "fieldset", "items": [{"key": "item_1616221921931.subitem_restricted_access_usage_report_id", "type": "text", "title": "Usage Report ID", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID "}, "title_i18n_temp": {"en": "Usage Report ID", "ja": "利用報告ID "}}], "title": "Usage Report ID", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID"}}, {"key": "item_1616221941275", "type": "fieldset", "items": [{"key": "item_1616221941275.subitem_restricted_access_research_title", "type": "text", "title": "Research Title", "title_i18n": {"en": "Research Title", "ja": "研究題目"}, "title_i18n_temp": {"en": "Research Title", "ja": "研究題目"}}], "title": "Research Title", "title_i18n": {"en": "Research Title", "ja": "研究題目"}}, {"key": "item_1616221960771", "type": "fieldset", "items": [{"key": "item_1616221960771.subitem_restricted_access_research_plan", "type": "textarea", "title": "Research Plan", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}, "title_i18n_temp": {"en": "Research Plan", "ja": "研究計画"}}, {"key": "item_1616221960771.subitem_restricted_access_research_plan_type", "type": "select", "title": "Research Plan Type", "readonly": true, "titleMap": [{"name": "Abstract", "value": "Abstract"}], "htmlClass": "hide", "title_i18n": {"en": "Research Plan Type", "ja": "研究計画タイプ"}, "title_i18n_temp": {"en": "Research Plan Type", "ja": "研究計画タイプ"}}], "title": "Research Plan", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}}, {"add": "New", "key": "item_1616221987611", "items": [{"key": "item_1616221987611[].filename", "type": "template", "title": "表示名", "onChange": "fileNameSelect(this, form, modelValue)", "titleMap": [], "title_i18n": {"en": "FileName", "ja": "表示名"}, "templateUrl": "/static/templates/weko_deposit/datalist.html", "fieldHtmlClass": "file-name", "title_i18n_temp": {"en": "FileName", "ja": "表示名"}}, {"key": "item_1616221987611[].url", "type": "fieldset", "items": [{"key": "item_1616221987611[].url.url", "type": "text", "title": "本文URL", "feedback": false, "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "fieldHtmlClass": "file-text-url", "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}, "disableSuccessState": true}, {"key": "item_1616221987611[].url.label", "type": "text", "title": "ラベル", "feedback": false, "title_i18n": {"en": "Label", "ja": "ラベル"}, "title_i18n_temp": {"en": "Label", "ja": "ラベル"}, "disableSuccessState": true}, {"key": "item_1616221987611[].url.objectType", "type": "select", "title": "オブジェクトタイプ", "feedback": false, "titleMap": [{"name": "abstract", "value": "abstract", "name_i18n": {"en": "abstract", "ja": "abstract"}}, {"name": "dataset", "value": "dataset", "name_i18n": {"en": "dataset", "ja": "dataset"}}, {"name": "fulltext", "value": "fulltext", "name_i18n": {"en": "fulltext", "ja": "fulltext"}}, {"name": "software", "value": "software", "name_i18n": {"en": "software", "ja": "software"}}, {"name": "summary", "value": "summary", "name_i18n": {"en": "summary", "ja": "summary"}}, {"name": "thumbnail", "value": "thumbnail", "name_i18n": {"en": "thumbnail", "ja": "thumbnail"}}, {"name": "other", "value": "other", "name_i18n": {"en": "other", "ja": "other"}}], "title_i18n": {"en": "Object Type", "ja": "オブジェクトタイプ"}, "title_i18n_temp": {"en": "Object Type", "ja": "オブジェクトタイプ"}, "disableSuccessState": true}], "title": "本文URL", "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}}, {"key": "item_1616221987611[].format", "type": "text", "title": "フォーマット", "title_i18n": {"en": "Format", "ja": "フォーマット"}, "title_i18n_temp": {"en": "Format", "ja": "フォーマット"}}, {"add": "New", "key": "item_1616221987611[].filesize", "items": [{"key": "item_1616221987611[].filesize[].value", "type": "text", "title": "サイズ", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}], "style": {"add": "btn-success"}, "title": "サイズ", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}, {"add": "New", "key": "item_1616221987611[].fileDate", "items": [{"key": "item_1616221987611[].fileDate[].fileDateType", "type": "select", "title": "日付タイプ", "titleMap": [{"name": "Accepted", "value": "Accepted"}, {"name": "Collected", "value": "Collected"}, {"name": "Copyrighted", "value": "Copyrighted"}, {"name": "Issued", "value": "Issued"}, {"name": "Submitted", "value": "Submitted"}, {"name": "Updated", "value": "Updated"}, {"name": "Valid", "value": "Valid"}], "title_i18n": {"en": "Date Type", "ja": "日付タイプ"}, "title_i18n_temp": {"en": "Date Type", "ja": "日付タイプ"}}, {"key": "item_1616221987611[].fileDate[].fileDateValue", "type": "template", "title": "日付", "format": "yyyy-MM-dd", "title_i18n": {"en": "Date", "ja": "日付"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "Date", "ja": "日付"}}], "style": {"add": "btn-success"}, "title": "日付", "title_i18n": {"en": "Date", "ja": "日付"}, "title_i18n_temp": {"en": "Date", "ja": "日付"}}, {"key": "item_1616221987611[].version", "type": "text", "title": "バージョン情報", "title_i18n": {"en": "Version Information", "ja": "バージョン情報"}, "title_i18n_temp": {"en": "Version Information", "ja": "バージョン情報"}}, {"key": "item_1616221987611[].displaytype", "type": "select", "title": "表示形式", "titleMap": [{"name": "詳細表示", "value": "detail", "name_i18n": {"en": "Detail", "ja": "詳細表示"}}, {"name": "簡易表示", "value": "simple", "name_i18n": {"en": "Simple", "ja": "簡易表示"}}, {"name": "プレビュー", "value": "preview", "name_i18n": {"en": "Preview", "ja": "プレビュー"}}], "title_i18n": {"en": "Preview", "ja": "表示形式"}, "title_i18n_temp": {"en": "Preview", "ja": "表示形式"}}, {"key": "item_1616221987611[].licensetype", "type": "select", "title": "ライセンス", "titleMap": [], "title_i18n": {"en": "License", "ja": "ライセンス"}, "title_i18n_temp": {"en": "License", "ja": "ライセンス"}}, {"key": "item_1616221987611[].licensefree", "type": "textarea", "notitle": true, "condition": "model.item_1616221987611[arrayIndex].licensetype == 'license_free'", "title_i18n": {"en": "自由ライセンス", "ja": "自由ライセンス"}}, {"type": "template", "title": "剽窃チェック", "template": "", "title_i18n": {"en": "Check Plagiarism", "ja": "剽窃チェック"}}, {"key": "item_1616221987611[].accessrole", "type": "radios", "title": "アクセス", "titleMap": [{"name": "オープンアクセス", "value": "open_access", "name_i18n": {"en": "Open access", "ja": "オープンアクセス"}}, {"name": "オープンアクセス日を指定する", "value": "open_date", "name_i18n": {"en": "Input Open Access Date", "ja": "オープンアクセス日を指定する"}}, {"name": "ログインユーザのみ", "value": "open_login", "name_i18n": {"en": "Registered User Only", "ja": "ログインユーザのみ"}}, {"name": "公開しない", "value": "open_no", "name_i18n": {"en": "Do not Publish", "ja": "公開しない"}}], "title_i18n": {"en": "Access", "ja": "アクセス"}, "title_i18n_temp": {"en": "Access", "ja": "アクセス"}}, {"key": "item_1616221987611[].date[0].dateValue", "type": "template", "title": "公開日", "format": "yyyy-MM-dd", "condition": "model.item_1616221987611[arrayIndex].accessrole == 'open_date'", "title_i18n": {"en": "Opendate", "ja": "公開日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html"}, {"key": "item_1616221987611[].groups", "type": "select", "title": "グループ", "titleMap": [], "condition": "model.item_1616221987611[arrayIndex].accessrole == 'open_login'", "title_i18n": {"en": "Group", "ja": "グループ"}, "title_i18n_temp": {"en": "Group", "ja": "グループ"}}], "style": {"add": "btn-success"}, "title": "Co-user List", "title_i18n": {"en": "Co-user List", "ja": "共同利用者リスト"}}, {"key": "item_1616222047122", "type": "fieldset", "items": [{"key": "item_1616222047122.subitem_restricted_access_wf_issued_date", "type": "template", "title": "WF Issued Date", "format": "yyyy-MM-dd", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "WF Issued Date", "ja": "WF起票日"}}, {"key": "item_1616222047122.subitem_restricted_access_wf_issued_date_type", "type": "select", "title": "WF Issued Date Type", "readonly": true, "titleMap": [{"name": "Created", "value": "Created"}], "htmlClass": "hide", "title_i18n": {"en": "WF Issued Date Type", "ja": "WF起票日タイプ"}, "title_i18n_temp": {"en": "WF Issued Date Type", "ja": "WF起票日タイプ"}}], "title": "WF Issued Date", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}}, {"key": "item_1616222067301", "type": "fieldset", "items": [{"key": "item_1616222067301.subitem_restricted_access_application_date", "type": "template", "title": "Application Date", "format": "yyyy-MM-dd", "title_i18n": {"en": "Application Date", "ja": "申請日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "Application Date", "ja": "申請日"}}, {"key": "item_1616222067301.subitem_restricted_access_application_date_type", "type": "select", "title": "Application Date Type", "readonly": true, "titleMap": [{"name": "Issued", "value": "Issued"}], "htmlClass": "hide", "title_i18n": {"en": "Application Date Type", "ja": "申請日タイプ"}, "title_i18n_temp": {"en": "Application Date Type", "ja": "申請日タイプ"}}], "title": "Application Date", "title_i18n": {"en": "Application Date", "ja": "申請日"}}, {"key": "item_1616222093486", "type": "fieldset", "items": [{"key": "item_1616222093486.subitem_restricted_access_approval_date", "type": "template", "title": "Approval Date", "format": "yyyy-MM-dd", "title_i18n": {"en": "Approval Date", "ja": "承認日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "Approval Date", "ja": "承認日"}}, {"key": "item_1616222093486.subitem_restricted_access_approval_date_type", "type": "select", "title": "Approval Date Type", "readonly": true, "titleMap": [{"name": "Accepted", "value": "Accepted"}], "htmlClass": "hide", "title_i18n": {"en": "Approval Date Type", "ja": "承認日タイプ "}, "title_i18n_temp": {"en": "Approval Date Type", "ja": "承認日タイプ"}}], "title": "Approval Date", "title_i18n": {"en": "Approval Date", "ja": "承認日"}}, {"key": "item_1616222117209", "type": "fieldset", "items": [{"key": "item_1616222117209.subitem_restricted_access_item_title", "type": "text", "title": "Item Title", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}, "title_i18n_temp": {"en": "Item Title", "ja": "アイテムタイトル"}}], "title": "Item Title", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}}, {"key": "system_identifier_doi", "type": "fieldset", "items": [{"key": "parentkey.subitem_systemidt_identifier", "type": "text", "title": "SYSTEMIDT Identifier"}, {"key": "parentkey.subitem_systemidt_identifier_type", "type": "select", "title": "SYSTEMIDT Identifier Type", "titleMap": [{"name": "DOI", "value": "DOI"}, {"name": "HDL", "value": "HDL"}, {"name": "URI", "value": "URI"}]}], "title": "Persistent Identifier(DOI)", "title_i18n": {"en": "Persistent Identifier(DOI)", "ja": "永続識別子(DOI)"}}, {"key": "system_identifier_hdl", "type": "fieldset", "items": [{"key": "parentkey.subitem_systemidt_identifier", "type": "text", "title": "SYSTEMIDT Identifier"}, {"key": "parentkey.subitem_systemidt_identifier_type", "type": "select", "title": "SYSTEMIDT Identifier Type", "titleMap": [{"name": "DOI", "value": "DOI"}, {"name": "HDL", "value": "HDL"}, {"name": "URI", "value": "URI"}]}], "title": "Persistent Identifier(HDL)", "title_i18n": {"en": "Persistent Identifier(HDL)", "ja": "永続識別子(HDL)"}}, {"key": "system_identifier_uri", "type": "fieldset", "items": [{"key": "parentkey.subitem_systemidt_identifier", "type": "text", "title": "SYSTEMIDT Identifier"}, {"key": "parentkey.subitem_systemidt_identifier_type", "type": "select", "title": "SYSTEMIDT Identifier Type", "titleMap": [{"name": "DOI", "value": "DOI"}, {"name": "HDL", "value": "HDL"}, {"name": "URI", "value": "URI"}]}], "title": "Persistent Identifier(URI)", "title_i18n": {"en": "Persistent Identifier(URI)", "ja": "永続識別子(URI)"}}, {"key": "system_file", "type": "fieldset", "items": [{"add": "New", "key": "parentkey.subitem_systemfile_filename", "items": [{"key": "parentkey.subitem_systemfile_filename[].subitem_systemfile_filename_label", "type": "text", "title": "SYSTEMFILE Filename Label"}, {"key": "parentkey.subitem_systemfile_filename[].subitem_systemfile_filename_type", "type": "select", "title": "SYSTEMFILE Filename Type", "titleMap": [{"name": "Abstract", "value": "Abstract"}, {"name": "Fulltext", "value": "Fulltext"}, {"name": "Summary", "value": "Summary"}, {"name": "Thumbnail", "value": "Thumbnail"}, {"name": "Other", "value": "Other"}]}, {"key": "parentkey.subitem_systemfile_filename[].subitem_systemfile_filename_uri", "type": "text", "title": "SYSTEMFILE Filename URI"}], "style": {"add": "btn-success"}, "title": "SYSTEMFILE Filename"}, {"key": "parentkey.subitem_systemfile_mimetype", "type": "text", "title": "SYSTEMFILE MimeType"}, {"key": "parentkey.subitem_systemfile_size", "type": "text", "title": "SYSTEMFILE Size"}, {"add": "New", "key": "parentkey.subitem_systemfile_datetime", "items": [{"key": "parentkey.subitem_systemfile_datetime[].subitem_systemfile_datetime_date", "type": "template", "title": "SYSTEMFILE DateTime Date", "format": "yyyy-MM-dd", "templateUrl": "/static/templates/weko_deposit/datepicker.html"}, {"key": "parentkey.subitem_systemfile_datetime[].subitem_systemfile_datetime_type", "type": "select", "title": "SYSTEMFILE DateTime Type", "titleMap": [{"name": "Accepted", "value": "Accepted"}, {"name": "Available", "value": "Available"}, {"name": "Collected", "value": "Collected"}, {"name": "Copyrighted", "value": "Copyrighted"}, {"name": "Created", "value": "Created"}, {"name": "Issued", "value": "Issued"}, {"name": "Submitted", "value": "Submitted"}, {"name": "Updated", "value": "Updated"}, {"name": "Valid", "value": "Valid"}]}], "style": {"add": "btn-success"}, "title": "SYSTEMFILE DateTime"}, {"key": "parentkey.subitem_systemfile_version", "type": "text", "title": "SYSTEMFILE Version"}], "title": "File Information", "title_i18n": {"en": "File Information", "ja": "ファイル情報"}}], "name": "利用申請", "action": "upt", "schema": {"type": "object", "$schema": "http://json-schema.org/draft-04/schema#", "required": ["pubdate"], "properties": {"pubdate": {"type": "string", "title": "PubDate", "format": "datetime"}, "system_file": {"type": "object", "title": "File Information", "format": "object", "properties": {"subitem_systemfile_size": {"type": "string", "title": "SYSTEMFILE Size", "format": "text"}, "subitem_systemfile_version": {"type": "string", "title": "SYSTEMFILE Version", "format": "text"}, "subitem_systemfile_datetime": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"subitem_systemfile_datetime_date": {"type": "string", "title": "SYSTEMFILE DateTime Date", "format": "datetime"}, "subitem_systemfile_datetime_type": {"enum": ["Accepted", "Available", "Collected", "Copyrighted", "Created", "Issued", "Submitted", "Updated", "Valid"], "type": "string", "title": "SYSTEMFILE DateTime Type", "format": "select"}}}, "title": "SYSTEMFILE DateTime", "format": "array"}, "subitem_systemfile_filename": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"subitem_systemfile_filename_uri": {"type": "string", "title": "SYSTEMFILE Filename URI", "format": "text"}, "subitem_systemfile_filename_type": {"enum": ["Abstract", "Fulltext", "Summary", "Thumbnail", "Other"], "type": "string", "title": "SYSTEMFILE Filename Type", "format": "select"}, "subitem_systemfile_filename_label": {"type": "string", "title": "SYSTEMFILE Filename Label", "format": "text"}}}, "title": "SYSTEMFILE Filename", "format": "array"}, "subitem_systemfile_mimetype": {"type": "string", "title": "SYSTEMFILE MimeType", "format": "text"}}, "system_prop": true}, "item_1616221831877": {"type": "object", "title": "Dataset Usage", "properties": {"subitem_restricted_access_dataset_usage": {"type": "string", "title": "Dataset Usage", "format": "text", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}, "title_i18n_temp": {"en": "Dataset Usage", "ja": "データ名"}}}}, "item_1616221851421": {"type": "object", "title": "Applicant", "properties": {"subitem_restricted_access_name": {"type": "string", "title": "Name", "format": "text", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, "subitem_restricted_access_position": {"type": ["null", "string"], "title": "Position", "format": "select", "currentEnum": []}, "subitem_restricted_access_mail_address": {"type": "string", "title": "Mail Address", "format": "text", "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, "subitem_restricted_access_phone_number": {"type": "string", "title": "Phone Number", "format": "text", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}, "subitem_restricted_access_position(others)": {"type": "string", "title": "Position(Others)", "format": "text", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, "subitem_restricted_access_university/institution": {"type": "string", "title": "University/Institution", "format": "text", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, "subitem_restricted_access_affiliated_division/department": {"type": "string", "title": "Affiliated Division/Department", "format": "text", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}}}, "item_1616221894659": {"type": "array", "items": {"type": "object", "properties": {"subitem_restricted_access_institution_name": {"type": "string", "title": "Institution Name", "format": "text", "title_i18n": {"en": "Institution Name", "ja": "所属学会名"}, "title_i18n_temp": {"en": "Institution Name", "ja": "所属学会名"}}, "subitem_restricted_access_institution_position": {"type": ["null", "string"], "title": "Institution Position", "format": "select", "currentEnum": []}}}, "title": "Applicant Affiliated Institution", "maxItems": 9999, "minItems": 1}, "item_1616221921931": {"type": "object", "title": "Usage Report ID", "properties": {"subitem_restricted_access_usage_report_id": {"type": "string", "title": "Usage Report ID", "format": "text", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID "}, "title_i18n_temp": {"en": "Usage Report ID", "ja": "利用報告ID "}}}}, "item_1616221941275": {"type": "object", "title": "Research Title", "properties": {"subitem_restricted_access_research_title": {"type": "string", "title": "Research Title", "format": "text", "title_i18n": {"en": "Research Title", "ja": "研究題目"}, "title_i18n_temp": {"en": "Research Title", "ja": "研究題目"}}}}, "item_1616221960771": {"type": "object", "title": "Research Plan", "properties": {"subitem_restricted_access_research_plan": {"type": "string", "title": "Research Plan", "format": "textarea", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}, "title_i18n_temp": {"en": "Research Plan", "ja": "研究計画"}}, "subitem_restricted_access_research_plan_type": {"enum": [null, "Abstract"], "type": ["null", "string"], "title": "Research Plan Type", "format": "select", "default": "Abstract", "currentEnum": ["Abstract"]}}}, "item_1616221987611": {"type": "array", "items": {"type": "object", "properties": {"url": {"type": "object", "title": "本文URL", "format": "object", "properties": {"url": {"type": "string", "title": "本文URL", "format": "text", "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}}, "label": {"type": "string", "title": "ラベル", "format": "text", "title_i18n": {"en": "Label", "ja": "ラベル"}, "title_i18n_temp": {"en": "Label", "ja": "ラベル"}}, "objectType": {"enum": [null, "abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"], "type": ["null", "string"], "title": "オブジェクトタイプ", "format": "select", "currentEnum": ["abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"]}}}, "date": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"dateType": {"type": ["null", "string"], "title": "日付タイプ", "format": "select", "currentEnum": []}, "dateValue": {"type": "string", "title": "日付", "format": "datetime", "title_i18n": {"en": "", "ja": ""}}}}, "title": "オープンアクセスの日付", "format": "array"}, "format": {"type": "string", "title": "フォーマット", "format": "text", "title_i18n": {"en": "Format", "ja": "フォーマット"}, "title_i18n_temp": {"en": "Format", "ja": "フォーマット"}}, "groups": {"type": ["null", "string"], "title": "グループ", "format": "select", "currentEnum": []}, "version": {"type": "string", "title": "バージョン情報", "format": "text", "title_i18n": {"en": "Version Information", "ja": "バージョン情報"}, "title_i18n_temp": {"en": "Version Information", "ja": "バージョン情報"}}, "fileDate": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"fileDateType": {"enum": [null, "Accepted", "Collected", "Copyrighted", "Issued", "Submitted", "Updated", "Valid"], "type": ["null", "string"], "title": "日付タイプ", "format": "select", "currentEnum": ["Accepted", "Collected", "Copyrighted", "Issued", "Submitted", "Updated", "Valid"]}, "fileDateValue": {"type": "string", "title": "日付", "format": "datetime", "title_i18n": {"en": "Date", "ja": "日付"}, "title_i18n_temp": {"en": "Date", "ja": "日付"}}}}, "title": "日付", "format": "array"}, "filename": {"type": ["null", "string"], "title": "表示名", "format": "text", "title_i18n": {"en": "FileName", "ja": "表示名"}, "title_i18n_temp": {"en": "FileName", "ja": "表示名"}}, "filesize": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"value": {"type": "string", "title": "サイズ", "format": "text", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}}}, "title": "サイズ", "format": "array"}, "accessrole": {"enum": ["open_access", "open_date", "open_login", "open_no"], "type": ["null", "string"], "title": "アクセス", "format": "radios"}, "displaytype": {"enum": [null, "detail", "simple", "preview"], "type": ["null", "string"], "title": "表示形式", "format": "select", "currentEnum": ["detail", "simple", "preview"]}, "licensefree": {"type": "string", "title": "自由ライセンス", "format": "textarea", "title_i18n": {"en": "自由ライセンス", "ja": "自由ライセンス"}}, "licensetype": {"type": ["null", "string"], "title": "ライセンス", "format": "select", "currentEnum": []}}}, "title": "Co-user List", "maxItems": 9999, "minItems": 1}, "item_1616222047122": {"type": "object", "title": "WF Issued Date", "properties": {"subitem_restricted_access_wf_issued_date": {"type": "string", "title": "WF Issued Date", "format": "datetime", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}, "title_i18n_temp": {"en": "WF Issued Date", "ja": "WF起票日"}}, "subitem_restricted_access_wf_issued_date_type": {"enum": [null, "Created"], "type": ["null", "string"], "title": "WF Issued Date Type", "format": "select", "default": "Created", "currentEnum": ["Created"]}}}, "item_1616222067301": {"type": "object", "title": "Application Date", "properties": {"subitem_restricted_access_application_date": {"type": "string", "title": "Application Date", "format": "datetime", "title_i18n": {"en": "Application Date", "ja": "申請日"}, "title_i18n_temp": {"en": "Application Date", "ja": "申請日"}}, "subitem_restricted_access_application_date_type": {"enum": [null, "Issued"], "type": ["null", "string"], "title": "Application Date Type", "format": "select", "default": "Issued", "currentEnum": ["Issued"]}}}, "item_1616222093486": {"type": "object", "title": "Approval Date", "properties": {"subitem_restricted_access_approval_date": {"type": "string", "title": "Approval Date", "format": "datetime", "title_i18n": {"en": "Approval Date", "ja": "承認日"}, "title_i18n_temp": {"en": "Approval Date", "ja": "承認日"}}, "subitem_restricted_access_approval_date_type": {"enum": [null, "Accepted"], "type": ["null", "string"], "title": "Approval Date Type", "format": "select", "default": "Accepted", "currentEnum": ["Accepted"]}}}, "item_1616222117209": {"type": "object", "title": "Item Title", "properties": {"subitem_restricted_access_item_title": {"type": "string", "title": "Item Title", "format": "text", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}, "title_i18n_temp": {"en": "Item Title", "ja": "アイテムタイトル"}}}}, "system_identifier_doi": {"type": "object", "title": "Persistent Identifier(DOI)", "format": "object", "properties": {"subitem_systemidt_identifier": {"type": "string", "title": "SYSTEMIDT Identifier", "format": "text"}, "subitem_systemidt_identifier_type": {"enum": ["DOI", "HDL", "URI"], "type": "string", "title": "SYSTEMIDT Identifier Type", "format": "select"}}, "system_prop": true}, "system_identifier_hdl": {"type": "object", "title": "Persistent Identifier(HDL)", "format": "object", "properties": {"subitem_systemidt_identifier": {"type": "string", "title": "SYSTEMIDT Identifier", "format": "text"}, "subitem_systemidt_identifier_type": {"enum": ["DOI", "HDL", "URI"], "type": "string", "title": "SYSTEMIDT Identifier Type", "format": "select"}}, "system_prop": true}, "system_identifier_uri": {"type": "object", "title": "Persistent Identifier(URI)", "format": "object", "properties": {"subitem_systemidt_identifier": {"type": "string", "title": "SYSTEMIDT Identifier", "format": "text"}, "subitem_systemidt_identifier_type": {"enum": ["DOI", "HDL", "URI"], "type": "string", "title": "SYSTEMIDT Identifier Type", "format": "select"}}, "system_prop": true}}, "description": ""}, "mapping": {"pubdate": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_file": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_file": {"URI": {"@value": "subitem_systemfile_filename_uri", "@attributes": {"label": "subitem_systemfile_filename_label", "objectType": "subitem_systemfile_filename_type"}}, "date": {"@value": "subitem_systemfile_datetime_date", "@attributes": {"dateType": "subitem_systemfile_datetime_type"}}, "extent": {"@value": "subitem_systemfile_size"}, "version": {"@value": "subitem_systemfile_version"}, "mimeType": {"@value": "subitem_systemfile_mimetype"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221831877": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"title": {"@value": "subitem_restricted_access_dataset_usage"}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221851421": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"creator": {"affiliation": {"affiliationName": {"@value": "subitem_restricted_access_university/institution"}}, "creatorName": {"@value": "subitem_restricted_access_name"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221894659": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221921931": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221941275": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221960771": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"description": {"@value": "subitem_restricted_access_research_plan", "@attributes": {"descriptionType": "subitem_restricted_access_research_plan_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221987611": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222047122": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"date": {"@value": "subitem_restricted_access_wf_issued_date", "@attributes": {"dateType": "subitem_restricted_access_wf_issued_date_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222067301": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"date": {"@value": "subitem_restricted_access_application_date", "@attributes": {"dateType": "subitem_restricted_access_application_date_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222093486": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"date": {"@value": "subitem_restricted_access_approval_date", "@attributes": {"dateType": "subitem_restricted_access_approval_date_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222117209": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"alternative": {"@value": "subitem_restricted_access_item_title"}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_identifier_doi": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_identifier": {"@value": "subitem_systemidt_identifier", "@attributes": {"identifierType": "subitem_systemidt_identifier_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_identifier_hdl": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_identifier": {"@value": "subitem_systemidt_identifier", "@attributes": {"identifierType": "subitem_systemidt_identifier_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_identifier_uri": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_identifier": {"@value": "subitem_systemidt_identifier", "@attributes": {"identifierType": "subitem_systemidt_identifier_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}}}}
\ No newline at end of file
diff --git a/modules/weko-records-ui/tests/data/itemtype_render_31002.json b/modules/weko-records-ui/tests/data/itemtype_render_31002.json
new file mode 100644
index 0000000000..d2b7e57ee4
--- /dev/null
+++ b/modules/weko-records-ui/tests/data/itemtype_render_31002.json
@@ -0,0 +1 @@
+{"meta_fix": {"pubdate": {"title": "PubDate", "option": {"crtf": false, "hidden": false, "multiple": false, "required": true, "showlist": false}, "input_type": "datetime", "title_i18n": {"en": "PubDate", "ja": "公開日"}, "input_value": ""}}, "meta_list": {"item_1616221831877": {"title": "Dataset Usage", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30001", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616221851421": {"title": "Applicant", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30002", "title_i18n": {"en": "Applicant", "ja": "申請者"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616221894659": {"title": "Applicant Affiliated Institution", "option": {"crtf": false, "hidden": false, "multiple": true, "required": false, "showlist": false}, "input_type": "cus_30003", "title_i18n": {"en": "Applicant Affiliated Institution", "ja": "申請者所属学会"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616221902404": {"title": "Guarantor", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30004", "title_i18n": {"en": "Guarantor", "ja": "保証人"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616221921931": {"title": "Usage Report ID", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30005", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616221941275": {"title": "Research Title", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30006", "title_i18n": {"en": "Research Title", "ja": "研究題目"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616221960771": {"title": "Research Plan", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30007", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616221987611": {"title": "Co-user List", "option": {"crtf": false, "hidden": false, "multiple": true, "required": false, "showlist": false}, "input_type": "cus_30008", "title_i18n": {"en": "Co-user List", "ja": "共同利用者リスト"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616222047122": {"title": "WF Issued Date", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30011", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616222067301": {"title": "Application Date", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30012", "title_i18n": {"en": "Application Date", "ja": "申請日"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616222093486": {"title": "Approval Date", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30013", "title_i18n": {"en": "Approval Date", "ja": "承認日"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}, "item_1616222117209": {"title": "Item Title", "option": {"crtf": false, "hidden": false, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_30014", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}, "input_value": "", "input_maxItems": "9999", "input_minItems": "1"}}, "table_row": ["item_1616221831877", "item_1616221851421", "item_1616221894659", "item_1616221902404", "item_1616221921931", "item_1616221941275", "item_1616221960771", "item_1616221987611", "item_1616222047122", "item_1616222067301", "item_1616222093486", "item_1616222117209"], "edit_notes": {"item_1616221831877": "", "item_1616221851421": "", "item_1616221894659": "", "item_1616221902404": "", "item_1616221921931": "", "item_1616221941275": "", "item_1616221960771": "", "item_1616221987611": "", "item_1616222047122": "", "item_1616222067301": "", "item_1616222093486": "", "item_1616222117209": ""}, "meta_system": {"system_file": {"title": "File Information", "option": {"crtf": false, "hidden": true, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_131", "title_i18n": {"en": "File Information", "ja": "ファイル情報"}, "input_value": ""}, "system_identifier_doi": {"title": "Persistent Identifier(DOI)", "option": {"crtf": false, "hidden": true, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_130", "title_i18n": {"en": "Persistent Identifier(DOI)", "ja": "永続識別子(DOI)"}, "input_value": ""}, "system_identifier_hdl": {"title": "Persistent Identifier(HDL)", "option": {"crtf": false, "hidden": true, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_130", "title_i18n": {"en": "Persistent Identifier(HDL)", "ja": "永続識別子(HDL)"}, "input_value": ""}, "system_identifier_uri": {"title": "Persistent Identifier(URI)", "option": {"crtf": false, "hidden": true, "multiple": false, "required": false, "showlist": false}, "input_type": "cus_130", "title_i18n": {"en": "Persistent Identifier(URI)", "ja": "永続識別子(URI)"}, "input_value": ""}}, "upload_file": false, "schemaeditor": {"schema": {"item_1616221831877": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_dataset_usage": {"type": "string", "title": "Dataset Usage", "format": "text", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}, "title_i18n_temp": {"en": "Dataset Usage", "ja": "データ名"}}}}, "item_1616221851421": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_name": {"type": "string", "title": "Name", "format": "text", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, "subitem_restricted_access_position": {"enum": [], "type": ["null", "string"], "title": "Position", "format": "select", "currentEnum": []}, "subitem_restricted_access_mail_address": {"type": "string", "title": "Mail Address", "format": "text", "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, "subitem_restricted_access_phone_number": {"type": "string", "title": "Phone Number", "format": "text", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}, "subitem_restricted_access_position(others)": {"type": "string", "title": "Position(Others)", "format": "text", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, "subitem_restricted_access_university/institution": {"type": "string", "title": "University/Institution", "format": "text", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, "subitem_restricted_access_affiliated_division/department": {"type": "string", "title": "Affiliated Division/Department", "format": "text", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}}}, "item_1616221894659": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_institution_name": {"type": "string", "title": "Institution Name", "format": "text", "title_i18n": {"en": "Institution Name", "ja": "所属学会名"}, "title_i18n_temp": {"en": "Institution Name", "ja": "所属学会名"}}, "subitem_restricted_access_institution_position": {"enum": [], "type": ["null", "string"], "title": "Institution Position", "format": "select", "currentEnum": []}}}, "item_1616221902404": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_guarantor_name": {"type": "string", "title": "Name", "format": "text", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, "subitem_restricted_access_guarantor_position": {"enum": [], "type": ["null", "string"], "title": "Position", "format": "select", "currentEnum": []}, "subitem_restricted_access_guarantor_mail_address": {"type": "string", "title": "Mail Address", "format": "text", "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, "subitem_restricted_access_guarantor_phone_number": {"type": "string", "title": "Phone Number", "format": "text", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}, "subitem_restricted_access_guarantor_position(others)": {"type": "string", "title": "Position(Others)", "format": "text", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, "subitem_restricted_access_guarantor_university/institution": {"type": "string", "title": "University/Institution", "format": "text", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, "subitem_restricted_access_guarantor_affiliated_division/department": {"type": "string", "title": "Affiliated Division/Department", "format": "text", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}}}, "item_1616221921931": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_usage_report_id": {"type": "string", "title": "Usage Report ID", "format": "text", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID "}, "title_i18n_temp": {"en": "Usage Report ID", "ja": "利用報告ID "}}}}, "item_1616221941275": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_research_title": {"type": "string", "title": "Research Title", "format": "text", "title_i18n": {"en": "Research Title", "ja": "研究題目"}, "title_i18n_temp": {"en": "Research Title", "ja": "研究題目"}}}}, "item_1616221960771": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_research_plan": {"type": "string", "title": "Research Plan", "format": "textarea", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}, "title_i18n_temp": {"en": "Research Plan", "ja": "研究計画"}}, "subitem_restricted_access_research_plan_type": {"enum": [null, "Abstract"], "type": ["null", "string"], "title": "Research Plan Type", "format": "select", "default": "Abstract", "currentEnum": ["Abstract"]}}}, "item_1616221987611": {"type": "object", "format": "object", "properties": {"url": {"type": "object", "title": "本文URL", "format": "object", "properties": {"url": {"type": "string", "title": "本文URL", "format": "text", "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}}, "label": {"type": "string", "title": "ラベル", "format": "text", "title_i18n": {"en": "Label", "ja": "ラベル"}, "title_i18n_temp": {"en": "Label", "ja": "ラベル"}}, "objectType": {"enum": [null, "abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"], "type": ["null", "string"], "title": "オブジェクトタイプ", "format": "select", "currentEnum": ["abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"]}}}, "date": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"dateType": {"enum": [], "type": ["null", "string"], "title": "日付タイプ", "format": "select", "currentEnum": []}, "dateValue": {"type": "string", "title": "日付", "format": "datetime", "title_i18n": {"en": "", "ja": ""}}}}, "title": "オープンアクセスの日付", "format": "array"}, "format": {"type": "string", "title": "フォーマット", "format": "text", "title_i18n": {"en": "Format", "ja": "フォーマット"}, "title_i18n_temp": {"en": "Format", "ja": "フォーマット"}}, "groups": {"enum": [], "type": ["null", "string"], "title": "グループ", "format": "select", "currentEnum": []}, "version": {"type": "string", "title": "バージョン情報", "format": "text", "title_i18n": {"en": "Version Information", "ja": "バージョン情報"}, "title_i18n_temp": {"en": "Version Information", "ja": "バージョン情報"}}, "fileDate": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"fileDateType": {"enum": [null, "Accepted", "Collected", "Copyrighted", "Issued", "Submitted", "Updated", "Valid"], "type": ["null", "string"], "title": "日付タイプ", "format": "select", "currentEnum": ["Accepted", "Collected", "Copyrighted", "Issued", "Submitted", "Updated", "Valid"]}, "fileDateValue": {"type": "string", "title": "日付", "format": "datetime", "title_i18n": {"en": "Date", "ja": "日付"}, "title_i18n_temp": {"en": "Date", "ja": "日付"}}}}, "title": "日付", "format": "array"}, "filename": {"enum": [], "type": ["null", "string"], "title": "表示名", "format": "text", "title_i18n": {"en": "FileName", "ja": "表示名"}, "title_i18n_temp": {"en": "FileName", "ja": "表示名"}}, "filesize": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"value": {"type": "string", "title": "サイズ", "format": "text", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}}}, "title": "サイズ", "format": "array"}, "accessrole": {"enum": ["open_access", "open_date", "open_login", "open_no"], "type": ["null", "string"], "title": "アクセス", "format": "radios"}, "displaytype": {"enum": [null, "detail", "simple", "preview"], "type": ["null", "string"], "title": "表示形式", "format": "select", "currentEnum": ["detail", "simple", "preview"]}, "licensefree": {"type": "string", "title": "自由ライセンス", "format": "textarea", "title_i18n": {"en": "自由ライセンス", "ja": "自由ライセンス"}}, "licensetype": {"enum": [], "type": ["null", "string"], "title": "ライセンス", "format": "select", "currentEnum": []}}}, "item_1616222047122": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_wf_issued_date": {"type": "string", "title": "WF Issued Date", "format": "datetime", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}, "title_i18n_temp": {"en": "WF Issued Date", "ja": "WF起票日"}}, "subitem_restricted_access_wf_issued_date_type": {"enum": [null, "Created"], "type": ["null", "string"], "title": "WF Issued Date Type", "format": "select", "default": "Created", "currentEnum": ["Created"]}}}, "item_1616222067301": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_application_date": {"type": "string", "title": "Application Date", "format": "datetime", "title_i18n": {"en": "Application Date", "ja": "申請日"}, "title_i18n_temp": {"en": "Application Date", "ja": "申請日"}}, "subitem_restricted_access_application_date_type": {"enum": [null, "Issued"], "type": ["null", "string"], "title": "Application Date Type", "format": "select", "default": "Issued", "currentEnum": ["Issued"]}}}, "item_1616222093486": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_approval_date": {"type": "string", "title": "Approval Date", "format": "datetime", "title_i18n": {"en": "Approval Date", "ja": "承認日"}, "title_i18n_temp": {"en": "Approval Date", "ja": "承認日"}}, "subitem_restricted_access_approval_date_type": {"enum": [null, "Accepted"], "type": ["null", "string"], "title": "Approval Date Type", "format": "select", "default": "Accepted", "currentEnum": ["Accepted"]}}}, "item_1616222117209": {"type": "object", "format": "object", "properties": {"subitem_restricted_access_item_title": {"type": "string", "title": "Item Title", "format": "text", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}, "title_i18n_temp": {"en": "Item Title", "ja": "アイテムタイトル"}}}}}}, "table_row_map": {"form": [{"key": "pubdate", "type": "template", "title": "PubDate", "format": "yyyy-MM-dd", "required": true, "title_i18n": {"en": "PubDate", "ja": "公開日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html"}, {"key": "item_1616221831877", "type": "fieldset", "items": [{"key": "item_1616221831877.subitem_restricted_access_dataset_usage", "type": "text", "title": "Dataset Usage", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}, "title_i18n_temp": {"en": "Dataset Usage", "ja": "データ名"}}], "title": "Dataset Usage", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}}, {"key": "item_1616221851421", "type": "fieldset", "items": [{"key": "item_1616221851421.subitem_restricted_access_name", "type": "text", "title": "Name", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, {"key": "item_1616221851421.subitem_restricted_access_mail_address", "type": "text", "title": "Mail Address", "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, {"key": "item_1616221851421.subitem_restricted_access_university/institution", "type": "text", "title": "University/Institution", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, {"key": "item_1616221851421.subitem_restricted_access_affiliated_division/department", "type": "text", "title": "Affiliated Division/Department", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}, {"key": "item_1616221851421.subitem_restricted_access_position", "type": "select", "title": "Position", "titleMap": [], "htmlClass": "cls-position", "title_i18n": {"en": "Position", "ja": "役職"}, "title_i18n_temp": {"en": "Position", "ja": "役職"}}, {"key": "item_1616221851421.subitem_restricted_access_position(others)", "type": "text", "title": "Position(Others)", "htmlClass": "cls-position-others", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, {"key": "item_1616221851421.subitem_restricted_access_phone_number", "type": "text", "title": "Phone Number", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}], "title": "Applicant", "title_i18n": {"en": "Applicant", "ja": "申請者"}}, {"add": "New", "key": "item_1616221894659", "items": [{"key": "item_1616221894659[].subitem_restricted_access_institution_name", "type": "text", "title": "Institution Name", "title_i18n": {"en": "Institution Name", "ja": "所属学会名"}, "title_i18n_temp": {"en": "Institution Name", "ja": "所属学会名"}}, {"key": "item_1616221894659[].subitem_restricted_access_institution_position", "type": "select", "title": "Institution Position", "titleMap": [], "title_i18n": {"en": "Institution Position", "ja": "所属学会役職"}, "title_i18n_temp": {"en": "Institution Position", "ja": "所属学会役職"}}], "style": {"add": "btn-success"}, "title": "Applicant Affiliated Institution", "title_i18n": {"en": "Applicant Affiliated Institution", "ja": "申請者所属学会"}}, {"key": "item_1616221902404", "type": "fieldset", "items": [{"key": "item_1616221902404.subitem_restricted_access_guarantor_name", "type": "text", "title": "Name", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, {"key": "item_1616221902404.subitem_restricted_access_guarantor_mail_address", "type": "text", "title": "Mail Address", "approval": true, "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, {"key": "item_1616221902404.subitem_restricted_access_guarantor_university/institution", "type": "text", "title": "University/Institution", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, {"key": "item_1616221902404.subitem_restricted_access_guarantor_affiliated_division/department", "type": "text", "title": "Affiliated Division/Department", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}, {"key": "item_1616221902404.subitem_restricted_access_guarantor_position", "type": "select", "title": "Position", "titleMap": [], "htmlClass": "cls-position", "title_i18n": {"en": "Position", "ja": "役職"}, "title_i18n_temp": {"en": "Position", "ja": "役職"}}, {"key": "item_1616221902404.subitem_restricted_access_guarantor_position(others)", "type": "text", "title": "Position(Others)", "htmlClass": "cls-position-others", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, {"key": "item_1616221902404.subitem_restricted_access_guarantor_phone_number", "type": "text", "title": "Phone Number", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}], "title": "Guarantor", "title_i18n": {"en": "Guarantor", "ja": "保証人"}}, {"key": "item_1616221921931", "type": "fieldset", "items": [{"key": "item_1616221921931.subitem_restricted_access_usage_report_id", "type": "text", "title": "Usage Report ID", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID "}, "title_i18n_temp": {"en": "Usage Report ID", "ja": "利用報告ID "}}], "title": "Usage Report ID", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID"}}, {"key": "item_1616221941275", "type": "fieldset", "items": [{"key": "item_1616221941275.subitem_restricted_access_research_title", "type": "text", "title": "Research Title", "title_i18n": {"en": "Research Title", "ja": "研究題目"}, "title_i18n_temp": {"en": "Research Title", "ja": "研究題目"}}], "title": "Research Title", "title_i18n": {"en": "Research Title", "ja": "研究題目"}}, {"key": "item_1616221960771", "type": "fieldset", "items": [{"key": "item_1616221960771.subitem_restricted_access_research_plan", "type": "textarea", "title": "Research Plan", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}, "title_i18n_temp": {"en": "Research Plan", "ja": "研究計画"}}, {"key": "item_1616221960771.subitem_restricted_access_research_plan_type", "type": "select", "title": "Research Plan Type", "readonly": true, "titleMap": [{"name": "Abstract", "value": "Abstract"}], "htmlClass": "hide", "title_i18n": {"en": "Research Plan Type", "ja": "研究計画タイプ"}, "title_i18n_temp": {"en": "Research Plan Type", "ja": "研究計画タイプ"}}], "title": "Research Plan", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}}, {"add": "New", "key": "item_1616221987611", "items": [{"key": "item_1616221987611[].filename", "type": "template", "title": "表示名", "onChange": "fileNameSelect(this, form, modelValue)", "titleMap": [], "title_i18n": {"en": "FileName", "ja": "表示名"}, "templateUrl": "/static/templates/weko_deposit/datalist.html", "fieldHtmlClass": "file-name", "title_i18n_temp": {"en": "FileName", "ja": "表示名"}}, {"key": "item_1616221987611[].url", "type": "fieldset", "items": [{"key": "item_1616221987611[].url.url", "type": "text", "title": "本文URL", "feedback": false, "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "fieldHtmlClass": "file-text-url", "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}, "disableSuccessState": true}, {"key": "item_1616221987611[].url.label", "type": "text", "title": "ラベル", "feedback": false, "title_i18n": {"en": "Label", "ja": "ラベル"}, "title_i18n_temp": {"en": "Label", "ja": "ラベル"}, "disableSuccessState": true}, {"key": "item_1616221987611[].url.objectType", "type": "select", "title": "オブジェクトタイプ", "feedback": false, "titleMap": [{"name": "abstract", "value": "abstract", "name_i18n": {"en": "abstract", "ja": "abstract"}}, {"name": "dataset", "value": "dataset", "name_i18n": {"en": "dataset", "ja": "dataset"}}, {"name": "fulltext", "value": "fulltext", "name_i18n": {"en": "fulltext", "ja": "fulltext"}}, {"name": "software", "value": "software", "name_i18n": {"en": "software", "ja": "software"}}, {"name": "summary", "value": "summary", "name_i18n": {"en": "summary", "ja": "summary"}}, {"name": "thumbnail", "value": "thumbnail", "name_i18n": {"en": "thumbnail", "ja": "thumbnail"}}, {"name": "other", "value": "other", "name_i18n": {"en": "other", "ja": "other"}}], "title_i18n": {"en": "Object Type", "ja": "オブジェクトタイプ"}, "title_i18n_temp": {"en": "Object Type", "ja": "オブジェクトタイプ"}, "disableSuccessState": true}], "title": "本文URL", "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}}, {"key": "item_1616221987611[].format", "type": "text", "title": "フォーマット", "title_i18n": {"en": "Format", "ja": "フォーマット"}, "title_i18n_temp": {"en": "Format", "ja": "フォーマット"}}, {"add": "New", "key": "item_1616221987611[].filesize", "items": [{"key": "item_1616221987611[].filesize[].value", "type": "text", "title": "サイズ", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}], "style": {"add": "btn-success"}, "title": "サイズ", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}, {"add": "New", "key": "item_1616221987611[].fileDate", "items": [{"key": "item_1616221987611[].fileDate[].fileDateType", "type": "select", "title": "日付タイプ", "titleMap": [{"name": "Accepted", "value": "Accepted"}, {"name": "Collected", "value": "Collected"}, {"name": "Copyrighted", "value": "Copyrighted"}, {"name": "Issued", "value": "Issued"}, {"name": "Submitted", "value": "Submitted"}, {"name": "Updated", "value": "Updated"}, {"name": "Valid", "value": "Valid"}], "title_i18n": {"en": "Date Type", "ja": "日付タイプ"}, "title_i18n_temp": {"en": "Date Type", "ja": "日付タイプ"}}, {"key": "item_1616221987611[].fileDate[].fileDateValue", "type": "template", "title": "日付", "format": "yyyy-MM-dd", "title_i18n": {"en": "Date", "ja": "日付"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "Date", "ja": "日付"}}], "style": {"add": "btn-success"}, "title": "日付", "title_i18n": {"en": "Date", "ja": "日付"}, "title_i18n_temp": {"en": "Date", "ja": "日付"}}, {"key": "item_1616221987611[].version", "type": "text", "title": "バージョン情報", "title_i18n": {"en": "Version Information", "ja": "バージョン情報"}, "title_i18n_temp": {"en": "Version Information", "ja": "バージョン情報"}}, {"key": "item_1616221987611[].displaytype", "type": "select", "title": "表示形式", "titleMap": [{"name": "詳細表示", "value": "detail", "name_i18n": {"en": "Detail", "ja": "詳細表示"}}, {"name": "簡易表示", "value": "simple", "name_i18n": {"en": "Simple", "ja": "簡易表示"}}, {"name": "プレビュー", "value": "preview", "name_i18n": {"en": "Preview", "ja": "プレビュー"}}], "title_i18n": {"en": "Preview", "ja": "表示形式"}, "title_i18n_temp": {"en": "Preview", "ja": "表示形式"}}, {"key": "item_1616221987611[].licensetype", "type": "select", "title": "ライセンス", "titleMap": [], "title_i18n": {"en": "License", "ja": "ライセンス"}, "title_i18n_temp": {"en": "License", "ja": "ライセンス"}}, {"key": "item_1616221987611[].licensefree", "type": "textarea", "notitle": true, "condition": "model.item_1616221987611[arrayIndex].licensetype == 'license_free'", "title_i18n": {"en": "自由ライセンス", "ja": "自由ライセンス"}}, {"type": "template", "title": "剽窃チェック", "template": "", "title_i18n": {"en": "Check Plagiarism", "ja": "剽窃チェック"}}, {"key": "item_1616221987611[].accessrole", "type": "radios", "title": "アクセス", "titleMap": [{"name": "オープンアクセス", "value": "open_access", "name_i18n": {"en": "Open access", "ja": "オープンアクセス"}}, {"name": "オープンアクセス日を指定する", "value": "open_date", "name_i18n": {"en": "Input Open Access Date", "ja": "オープンアクセス日を指定する"}}, {"name": "ログインユーザのみ", "value": "open_login", "name_i18n": {"en": "Registered User Only", "ja": "ログインユーザのみ"}}, {"name": "公開しない", "value": "open_no", "name_i18n": {"en": "Do not Publish", "ja": "公開しない"}}], "title_i18n": {"en": "Access", "ja": "アクセス"}, "title_i18n_temp": {"en": "Access", "ja": "アクセス"}}, {"key": "item_1616221987611[].date[0].dateValue", "type": "template", "title": "公開日", "format": "yyyy-MM-dd", "condition": "model.item_1616221987611[arrayIndex].accessrole == 'open_date'", "title_i18n": {"en": "Opendate", "ja": "公開日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html"}, {"key": "item_1616221987611[].groups", "type": "select", "title": "グループ", "titleMap": [], "condition": "model.item_1616221987611[arrayIndex].accessrole == 'open_login'", "title_i18n": {"en": "Group", "ja": "グループ"}, "title_i18n_temp": {"en": "Group", "ja": "グループ"}}], "style": {"add": "btn-success"}, "title": "Co-user List", "title_i18n": {"en": "Co-user List", "ja": "共同利用者リスト"}}, {"key": "item_1616222047122", "type": "fieldset", "items": [{"key": "item_1616222047122.subitem_restricted_access_wf_issued_date", "type": "template", "title": "WF Issued Date", "format": "yyyy-MM-dd", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "WF Issued Date", "ja": "WF起票日"}}, {"key": "item_1616222047122.subitem_restricted_access_wf_issued_date_type", "type": "select", "title": "WF Issued Date Type", "readonly": true, "titleMap": [{"name": "Created", "value": "Created"}], "htmlClass": "hide", "title_i18n": {"en": "WF Issued Date Type", "ja": "WF起票日タイプ"}, "title_i18n_temp": {"en": "WF Issued Date Type", "ja": "WF起票日タイプ"}}], "title": "WF Issued Date", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}}, {"key": "item_1616222067301", "type": "fieldset", "items": [{"key": "item_1616222067301.subitem_restricted_access_application_date", "type": "template", "title": "Application Date", "format": "yyyy-MM-dd", "title_i18n": {"en": "Application Date", "ja": "申請日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "Application Date", "ja": "申請日"}}, {"key": "item_1616222067301.subitem_restricted_access_application_date_type", "type": "select", "title": "Application Date Type", "readonly": true, "titleMap": [{"name": "Issued", "value": "Issued"}], "htmlClass": "hide", "title_i18n": {"en": "Application Date Type", "ja": "申請日タイプ"}, "title_i18n_temp": {"en": "Application Date Type", "ja": "申請日タイプ"}}], "title": "Application Date", "title_i18n": {"en": "Application Date", "ja": "申請日"}}, {"key": "item_1616222093486", "type": "fieldset", "items": [{"key": "item_1616222093486.subitem_restricted_access_approval_date", "type": "template", "title": "Approval Date", "format": "yyyy-MM-dd", "title_i18n": {"en": "Approval Date", "ja": "承認日"}, "templateUrl": "/static/templates/weko_deposit/datepicker.html", "title_i18n_temp": {"en": "Approval Date", "ja": "承認日"}}, {"key": "item_1616222093486.subitem_restricted_access_approval_date_type", "type": "select", "title": "Approval Date Type", "readonly": true, "titleMap": [{"name": "Accepted", "value": "Accepted"}], "htmlClass": "hide", "title_i18n": {"en": "Approval Date Type", "ja": "承認日タイプ "}, "title_i18n_temp": {"en": "Approval Date Type", "ja": "承認日タイプ"}}], "title": "Approval Date", "title_i18n": {"en": "Approval Date", "ja": "承認日"}}, {"key": "item_1616222117209", "type": "fieldset", "items": [{"key": "item_1616222117209.subitem_restricted_access_item_title", "type": "text", "title": "Item Title", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}, "title_i18n_temp": {"en": "Item Title", "ja": "アイテムタイトル"}}], "title": "Item Title", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}}, {"key": "system_identifier_doi", "type": "fieldset", "items": [{"key": "parentkey.subitem_systemidt_identifier", "type": "text", "title": "SYSTEMIDT Identifier"}, {"key": "parentkey.subitem_systemidt_identifier_type", "type": "select", "title": "SYSTEMIDT Identifier Type", "titleMap": [{"name": "DOI", "value": "DOI"}, {"name": "HDL", "value": "HDL"}, {"name": "URI", "value": "URI"}]}], "title": "Persistent Identifier(DOI)", "title_i18n": {"en": "Persistent Identifier(DOI)", "ja": "永続識別子(DOI)"}}, {"key": "system_identifier_hdl", "type": "fieldset", "items": [{"key": "parentkey.subitem_systemidt_identifier", "type": "text", "title": "SYSTEMIDT Identifier"}, {"key": "parentkey.subitem_systemidt_identifier_type", "type": "select", "title": "SYSTEMIDT Identifier Type", "titleMap": [{"name": "DOI", "value": "DOI"}, {"name": "HDL", "value": "HDL"}, {"name": "URI", "value": "URI"}]}], "title": "Persistent Identifier(HDL)", "title_i18n": {"en": "Persistent Identifier(HDL)", "ja": "永続識別子(HDL)"}}, {"key": "system_identifier_uri", "type": "fieldset", "items": [{"key": "parentkey.subitem_systemidt_identifier", "type": "text", "title": "SYSTEMIDT Identifier"}, {"key": "parentkey.subitem_systemidt_identifier_type", "type": "select", "title": "SYSTEMIDT Identifier Type", "titleMap": [{"name": "DOI", "value": "DOI"}, {"name": "HDL", "value": "HDL"}, {"name": "URI", "value": "URI"}]}], "title": "Persistent Identifier(URI)", "title_i18n": {"en": "Persistent Identifier(URI)", "ja": "永続識別子(URI)"}}, {"key": "system_file", "type": "fieldset", "items": [{"add": "New", "key": "parentkey.subitem_systemfile_filename", "items": [{"key": "parentkey.subitem_systemfile_filename[].subitem_systemfile_filename_label", "type": "text", "title": "SYSTEMFILE Filename Label"}, {"key": "parentkey.subitem_systemfile_filename[].subitem_systemfile_filename_type", "type": "select", "title": "SYSTEMFILE Filename Type", "titleMap": [{"name": "Abstract", "value": "Abstract"}, {"name": "Fulltext", "value": "Fulltext"}, {"name": "Summary", "value": "Summary"}, {"name": "Thumbnail", "value": "Thumbnail"}, {"name": "Other", "value": "Other"}]}, {"key": "parentkey.subitem_systemfile_filename[].subitem_systemfile_filename_uri", "type": "text", "title": "SYSTEMFILE Filename URI"}], "style": {"add": "btn-success"}, "title": "SYSTEMFILE Filename"}, {"key": "parentkey.subitem_systemfile_mimetype", "type": "text", "title": "SYSTEMFILE MimeType"}, {"key": "parentkey.subitem_systemfile_size", "type": "text", "title": "SYSTEMFILE Size"}, {"add": "New", "key": "parentkey.subitem_systemfile_datetime", "items": [{"key": "parentkey.subitem_systemfile_datetime[].subitem_systemfile_datetime_date", "type": "template", "title": "SYSTEMFILE DateTime Date", "format": "yyyy-MM-dd", "templateUrl": "/static/templates/weko_deposit/datepicker.html"}, {"key": "parentkey.subitem_systemfile_datetime[].subitem_systemfile_datetime_type", "type": "select", "title": "SYSTEMFILE DateTime Type", "titleMap": [{"name": "Accepted", "value": "Accepted"}, {"name": "Available", "value": "Available"}, {"name": "Collected", "value": "Collected"}, {"name": "Copyrighted", "value": "Copyrighted"}, {"name": "Created", "value": "Created"}, {"name": "Issued", "value": "Issued"}, {"name": "Submitted", "value": "Submitted"}, {"name": "Updated", "value": "Updated"}, {"name": "Valid", "value": "Valid"}]}], "style": {"add": "btn-success"}, "title": "SYSTEMFILE DateTime"}, {"key": "parentkey.subitem_systemfile_version", "type": "text", "title": "SYSTEMFILE Version"}], "title": "File Information", "title_i18n": {"en": "File Information", "ja": "ファイル情報"}}], "name": "二段階利用申請", "action": "upt", "schema": {"type": "object", "$schema": "http://json-schema.org/draft-04/schema#", "required": ["pubdate"], "properties": {"pubdate": {"type": "string", "title": "PubDate", "format": "datetime"}, "system_file": {"type": "object", "title": "File Information", "format": "object", "properties": {"subitem_systemfile_size": {"type": "string", "title": "SYSTEMFILE Size", "format": "text"}, "subitem_systemfile_version": {"type": "string", "title": "SYSTEMFILE Version", "format": "text"}, "subitem_systemfile_datetime": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"subitem_systemfile_datetime_date": {"type": "string", "title": "SYSTEMFILE DateTime Date", "format": "datetime"}, "subitem_systemfile_datetime_type": {"enum": ["Accepted", "Available", "Collected", "Copyrighted", "Created", "Issued", "Submitted", "Updated", "Valid"], "type": "string", "title": "SYSTEMFILE DateTime Type", "format": "select"}}}, "title": "SYSTEMFILE DateTime", "format": "array"}, "subitem_systemfile_filename": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"subitem_systemfile_filename_uri": {"type": "string", "title": "SYSTEMFILE Filename URI", "format": "text"}, "subitem_systemfile_filename_type": {"enum": ["Abstract", "Fulltext", "Summary", "Thumbnail", "Other"], "type": "string", "title": "SYSTEMFILE Filename Type", "format": "select"}, "subitem_systemfile_filename_label": {"type": "string", "title": "SYSTEMFILE Filename Label", "format": "text"}}}, "title": "SYSTEMFILE Filename", "format": "array"}, "subitem_systemfile_mimetype": {"type": "string", "title": "SYSTEMFILE MimeType", "format": "text"}}, "system_prop": true}, "item_1616221831877": {"type": "object", "title": "Dataset Usage", "properties": {"subitem_restricted_access_dataset_usage": {"type": "string", "title": "Dataset Usage", "format": "text", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}, "title_i18n_temp": {"en": "Dataset Usage", "ja": "データ名"}}}}, "item_1616221851421": {"type": "object", "title": "Applicant", "properties": {"subitem_restricted_access_name": {"type": "string", "title": "Name", "format": "text", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, "subitem_restricted_access_position": {"type": ["null", "string"], "title": "Position", "format": "select", "currentEnum": []}, "subitem_restricted_access_mail_address": {"type": "string", "title": "Mail Address", "format": "text", "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, "subitem_restricted_access_phone_number": {"type": "string", "title": "Phone Number", "format": "text", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}, "subitem_restricted_access_position(others)": {"type": "string", "title": "Position(Others)", "format": "text", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, "subitem_restricted_access_university/institution": {"type": "string", "title": "University/Institution", "format": "text", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, "subitem_restricted_access_affiliated_division/department": {"type": "string", "title": "Affiliated Division/Department", "format": "text", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}}}, "item_1616221894659": {"type": "array", "items": {"type": "object", "properties": {"subitem_restricted_access_institution_name": {"type": "string", "title": "Institution Name", "format": "text", "title_i18n": {"en": "Institution Name", "ja": "所属学会名"}, "title_i18n_temp": {"en": "Institution Name", "ja": "所属学会名"}}, "subitem_restricted_access_institution_position": {"type": ["null", "string"], "title": "Institution Position", "format": "select", "currentEnum": []}}}, "title": "Applicant Affiliated Institution", "maxItems": 9999, "minItems": 1}, "item_1616221902404": {"type": "object", "title": "Guarantor", "properties": {"subitem_restricted_access_guarantor_name": {"type": "string", "title": "Name", "format": "text", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, "subitem_restricted_access_guarantor_position": {"type": ["null", "string"], "title": "Position", "format": "select", "currentEnum": []}, "subitem_restricted_access_guarantor_mail_address": {"type": "string", "title": "Mail Address", "format": "text", "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, "subitem_restricted_access_guarantor_phone_number": {"type": "string", "title": "Phone Number", "format": "text", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}, "subitem_restricted_access_guarantor_position(others)": {"type": "string", "title": "Position(Others)", "format": "text", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, "subitem_restricted_access_guarantor_university/institution": {"type": "string", "title": "University/Institution", "format": "text", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, "subitem_restricted_access_guarantor_affiliated_division/department": {"type": "string", "title": "Affiliated Division/Department", "format": "text", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}}}, "item_1616221921931": {"type": "object", "title": "Usage Report ID", "properties": {"subitem_restricted_access_usage_report_id": {"type": "string", "title": "Usage Report ID", "format": "text", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID "}, "title_i18n_temp": {"en": "Usage Report ID", "ja": "利用報告ID "}}}}, "item_1616221941275": {"type": "object", "title": "Research Title", "properties": {"subitem_restricted_access_research_title": {"type": "string", "title": "Research Title", "format": "text", "title_i18n": {"en": "Research Title", "ja": "研究題目"}, "title_i18n_temp": {"en": "Research Title", "ja": "研究題目"}}}}, "item_1616221960771": {"type": "object", "title": "Research Plan", "properties": {"subitem_restricted_access_research_plan": {"type": "string", "title": "Research Plan", "format": "textarea", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}, "title_i18n_temp": {"en": "Research Plan", "ja": "研究計画"}}, "subitem_restricted_access_research_plan_type": {"enum": [null, "Abstract"], "type": ["null", "string"], "title": "Research Plan Type", "format": "select", "default": "Abstract", "currentEnum": ["Abstract"]}}}, "item_1616221987611": {"type": "array", "items": {"type": "object", "properties": {"url": {"type": "object", "title": "本文URL", "format": "object", "properties": {"url": {"type": "string", "title": "本文URL", "format": "text", "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}}, "label": {"type": "string", "title": "ラベル", "format": "text", "title_i18n": {"en": "Label", "ja": "ラベル"}, "title_i18n_temp": {"en": "Label", "ja": "ラベル"}}, "objectType": {"enum": [null, "abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"], "type": ["null", "string"], "title": "オブジェクトタイプ", "format": "select", "currentEnum": ["abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"]}}}, "date": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"dateType": {"type": ["null", "string"], "title": "日付タイプ", "format": "select", "currentEnum": []}, "dateValue": {"type": "string", "title": "日付", "format": "datetime", "title_i18n": {"en": "", "ja": ""}}}}, "title": "オープンアクセスの日付", "format": "array"}, "format": {"type": "string", "title": "フォーマット", "format": "text", "title_i18n": {"en": "Format", "ja": "フォーマット"}, "title_i18n_temp": {"en": "Format", "ja": "フォーマット"}}, "groups": {"type": ["null", "string"], "title": "グループ", "format": "select", "currentEnum": []}, "version": {"type": "string", "title": "バージョン情報", "format": "text", "title_i18n": {"en": "Version Information", "ja": "バージョン情報"}, "title_i18n_temp": {"en": "Version Information", "ja": "バージョン情報"}}, "fileDate": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"fileDateType": {"enum": [null, "Accepted", "Collected", "Copyrighted", "Issued", "Submitted", "Updated", "Valid"], "type": ["null", "string"], "title": "日付タイプ", "format": "select", "currentEnum": ["Accepted", "Collected", "Copyrighted", "Issued", "Submitted", "Updated", "Valid"]}, "fileDateValue": {"type": "string", "title": "日付", "format": "datetime", "title_i18n": {"en": "Date", "ja": "日付"}, "title_i18n_temp": {"en": "Date", "ja": "日付"}}}}, "title": "日付", "format": "array"}, "filename": {"type": ["null", "string"], "title": "表示名", "format": "text", "title_i18n": {"en": "FileName", "ja": "表示名"}, "title_i18n_temp": {"en": "FileName", "ja": "表示名"}}, "filesize": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"value": {"type": "string", "title": "サイズ", "format": "text", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}}}, "title": "サイズ", "format": "array"}, "accessrole": {"enum": ["open_access", "open_date", "open_login", "open_no"], "type": ["null", "string"], "title": "アクセス", "format": "radios"}, "displaytype": {"enum": [null, "detail", "simple", "preview"], "type": ["null", "string"], "title": "表示形式", "format": "select", "currentEnum": ["detail", "simple", "preview"]}, "licensefree": {"type": "string", "title": "自由ライセンス", "format": "textarea", "title_i18n": {"en": "自由ライセンス", "ja": "自由ライセンス"}}, "licensetype": {"type": ["null", "string"], "title": "ライセンス", "format": "select", "currentEnum": []}}}, "title": "Co-user List", "maxItems": 9999, "minItems": 1}, "item_1616222047122": {"type": "object", "title": "WF Issued Date", "properties": {"subitem_restricted_access_wf_issued_date": {"type": "string", "title": "WF Issued Date", "format": "datetime", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}, "title_i18n_temp": {"en": "WF Issued Date", "ja": "WF起票日"}}, "subitem_restricted_access_wf_issued_date_type": {"enum": [null, "Created"], "type": ["null", "string"], "title": "WF Issued Date Type", "format": "select", "default": "Created", "currentEnum": ["Created"]}}}, "item_1616222067301": {"type": "object", "title": "Application Date", "properties": {"subitem_restricted_access_application_date": {"type": "string", "title": "Application Date", "format": "datetime", "title_i18n": {"en": "Application Date", "ja": "申請日"}, "title_i18n_temp": {"en": "Application Date", "ja": "申請日"}}, "subitem_restricted_access_application_date_type": {"enum": [null, "Issued"], "type": ["null", "string"], "title": "Application Date Type", "format": "select", "default": "Issued", "currentEnum": ["Issued"]}}}, "item_1616222093486": {"type": "object", "title": "Approval Date", "properties": {"subitem_restricted_access_approval_date": {"type": "string", "title": "Approval Date", "format": "datetime", "title_i18n": {"en": "Approval Date", "ja": "承認日"}, "title_i18n_temp": {"en": "Approval Date", "ja": "承認日"}}, "subitem_restricted_access_approval_date_type": {"enum": [null, "Accepted"], "type": ["null", "string"], "title": "Approval Date Type", "format": "select", "default": "Accepted", "currentEnum": ["Accepted"]}}}, "item_1616222117209": {"type": "object", "title": "Item Title", "properties": {"subitem_restricted_access_item_title": {"type": "string", "title": "Item Title", "format": "text", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}, "title_i18n_temp": {"en": "Item Title", "ja": "アイテムタイトル"}}}}, "system_identifier_doi": {"type": "object", "title": "Persistent Identifier(DOI)", "format": "object", "properties": {"subitem_systemidt_identifier": {"type": "string", "title": "SYSTEMIDT Identifier", "format": "text"}, "subitem_systemidt_identifier_type": {"enum": ["DOI", "HDL", "URI"], "type": "string", "title": "SYSTEMIDT Identifier Type", "format": "select"}}, "system_prop": true}, "system_identifier_hdl": {"type": "object", "title": "Persistent Identifier(HDL)", "format": "object", "properties": {"subitem_systemidt_identifier": {"type": "string", "title": "SYSTEMIDT Identifier", "format": "text"}, "subitem_systemidt_identifier_type": {"enum": ["DOI", "HDL", "URI"], "type": "string", "title": "SYSTEMIDT Identifier Type", "format": "select"}}, "system_prop": true}, "system_identifier_uri": {"type": "object", "title": "Persistent Identifier(URI)", "format": "object", "properties": {"subitem_systemidt_identifier": {"type": "string", "title": "SYSTEMIDT Identifier", "format": "text"}, "subitem_systemidt_identifier_type": {"enum": ["DOI", "HDL", "URI"], "type": "string", "title": "SYSTEMIDT Identifier Type", "format": "select"}}, "system_prop": true}}, "description": ""}, "mapping": {"pubdate": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_file": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_file": {"URI": {"@value": "subitem_systemfile_filename_uri", "@attributes": {"label": "subitem_systemfile_filename_label", "objectType": "subitem_systemfile_filename_type"}}, "date": {"@value": "subitem_systemfile_datetime_date", "@attributes": {"dateType": "subitem_systemfile_datetime_type"}}, "extent": {"@value": "subitem_systemfile_size"}, "version": {"@value": "subitem_systemfile_version"}, "mimeType": {"@value": "subitem_systemfile_mimetype"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221831877": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"title": {"@value": "subitem_restricted_access_dataset_usage"}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221851421": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"creator": {"affiliation": {"affiliationName": {"@value": "subitem_restricted_access_university/institution"}}, "creatorName": {"@value": "subitem_restricted_access_name"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221894659": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221902404": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221921931": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221941275": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221960771": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"description": {"@value": "subitem_restricted_access_research_plan", "@attributes": {"descriptionType": "subitem_restricted_access_research_plan_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616221987611": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": "", "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222047122": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"date": {"@value": "subitem_restricted_access_wf_issued_date", "@attributes": {"dateType": "subitem_restricted_access_wf_issued_date_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222067301": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"date": {"@value": "subitem_restricted_access_application_date", "@attributes": {"dateType": "subitem_restricted_access_application_date_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222093486": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"date": {"@value": "subitem_restricted_access_approval_date", "@attributes": {"dateType": "subitem_restricted_access_approval_date_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "item_1616222117209": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"alternative": {"@value": "subitem_restricted_access_item_title"}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_identifier_doi": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_identifier": {"@value": "subitem_systemidt_identifier", "@attributes": {"identifierType": "subitem_systemidt_identifier_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_identifier_hdl": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_identifier": {"@value": "subitem_systemidt_identifier", "@attributes": {"identifierType": "subitem_systemidt_identifier_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}, "system_identifier_uri": {"lom_mapping": "", "lido_mapping": "", "spase_mapping": "", "jpcoar_mapping": {"system_identifier": {"@value": "subitem_systemidt_identifier", "@attributes": {"identifierType": "subitem_systemidt_identifier_type"}}}, "junii2_mapping": "", "oai_dc_mapping": "", "display_lang_type": ""}}}}
\ No newline at end of file
diff --git a/modules/weko-records-ui/tests/data/itemtype_schema_31001.json b/modules/weko-records-ui/tests/data/itemtype_schema_31001.json
new file mode 100644
index 0000000000..94690a9388
--- /dev/null
+++ b/modules/weko-records-ui/tests/data/itemtype_schema_31001.json
@@ -0,0 +1 @@
+{"type": "object", "$schema": "http://json-schema.org/draft-04/schema#", "required": ["pubdate"], "properties": {"pubdate": {"type": "string", "title": "PubDate", "format": "datetime"}, "system_file": {"type": "object", "title": "File Information", "format": "object", "properties": {"subitem_systemfile_size": {"type": "string", "title": "SYSTEMFILE Size", "format": "text"}, "subitem_systemfile_version": {"type": "string", "title": "SYSTEMFILE Version", "format": "text"}, "subitem_systemfile_datetime": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"subitem_systemfile_datetime_date": {"type": "string", "title": "SYSTEMFILE DateTime Date", "format": "datetime"}, "subitem_systemfile_datetime_type": {"enum": ["Accepted", "Available", "Collected", "Copyrighted", "Created", "Issued", "Submitted", "Updated", "Valid"], "type": "string", "title": "SYSTEMFILE DateTime Type", "format": "select"}}}, "title": "SYSTEMFILE DateTime", "format": "array"}, "subitem_systemfile_filename": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"subitem_systemfile_filename_uri": {"type": "string", "title": "SYSTEMFILE Filename URI", "format": "text"}, "subitem_systemfile_filename_type": {"enum": ["Abstract", "Fulltext", "Summary", "Thumbnail", "Other"], "type": "string", "title": "SYSTEMFILE Filename Type", "format": "select"}, "subitem_systemfile_filename_label": {"type": "string", "title": "SYSTEMFILE Filename Label", "format": "text"}}}, "title": "SYSTEMFILE Filename", "format": "array"}, "subitem_systemfile_mimetype": {"type": "string", "title": "SYSTEMFILE MimeType", "format": "text"}}, "system_prop": true}, "item_1616221831877": {"type": "object", "title": "Dataset Usage", "properties": {"subitem_restricted_access_dataset_usage": {"type": "string", "title": "Dataset Usage", "format": "text", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}, "title_i18n_temp": {"en": "Dataset Usage", "ja": "データ名"}}}}, "item_1616221851421": {"type": "object", "title": "Applicant", "properties": {"subitem_restricted_access_name": {"type": "string", "title": "Name", "format": "text", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, "subitem_restricted_access_position": {"type": ["null", "string"], "title": "Position", "format": "select", "currentEnum": []}, "subitem_restricted_access_mail_address": {"type": "string", "title": "Mail Address", "format": "text", "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, "subitem_restricted_access_phone_number": {"type": "string", "title": "Phone Number", "format": "text", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}, "subitem_restricted_access_position(others)": {"type": "string", "title": "Position(Others)", "format": "text", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, "subitem_restricted_access_university/institution": {"type": "string", "title": "University/Institution", "format": "text", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, "subitem_restricted_access_affiliated_division/department": {"type": "string", "title": "Affiliated Division/Department", "format": "text", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}}}, "item_1616221894659": {"type": "array", "items": {"type": "object", "properties": {"subitem_restricted_access_institution_name": {"type": "string", "title": "Institution Name", "format": "text", "title_i18n": {"en": "Institution Name", "ja": "所属学会名"}, "title_i18n_temp": {"en": "Institution Name", "ja": "所属学会名"}}, "subitem_restricted_access_institution_position": {"type": ["null", "string"], "title": "Institution Position", "format": "select", "currentEnum": []}}}, "title": "Applicant Affiliated Institution", "maxItems": 9999, "minItems": 1}, "item_1616221921931": {"type": "object", "title": "Usage Report ID", "properties": {"subitem_restricted_access_usage_report_id": {"type": "string", "title": "Usage Report ID", "format": "text", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID "}, "title_i18n_temp": {"en": "Usage Report ID", "ja": "利用報告ID "}}}}, "item_1616221941275": {"type": "object", "title": "Research Title", "properties": {"subitem_restricted_access_research_title": {"type": "string", "title": "Research Title", "format": "text", "title_i18n": {"en": "Research Title", "ja": "研究題目"}, "title_i18n_temp": {"en": "Research Title", "ja": "研究題目"}}}}, "item_1616221960771": {"type": "object", "title": "Research Plan", "properties": {"subitem_restricted_access_research_plan": {"type": "string", "title": "Research Plan", "format": "textarea", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}, "title_i18n_temp": {"en": "Research Plan", "ja": "研究計画"}}, "subitem_restricted_access_research_plan_type": {"enum": [null, "Abstract"], "type": ["null", "string"], "title": "Research Plan Type", "format": "select", "default": "Abstract", "currentEnum": ["Abstract"]}}}, "item_1616221987611": {"type": "array", "items": {"type": "object", "properties": {"url": {"type": "object", "title": "本文URL", "format": "object", "properties": {"url": {"type": "string", "title": "本文URL", "format": "text", "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}}, "label": {"type": "string", "title": "ラベル", "format": "text", "title_i18n": {"en": "Label", "ja": "ラベル"}, "title_i18n_temp": {"en": "Label", "ja": "ラベル"}}, "objectType": {"enum": [null, "abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"], "type": ["null", "string"], "title": "オブジェクトタイプ", "format": "select", "currentEnum": ["abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"]}}}, "date": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"dateType": {"type": ["null", "string"], "title": "日付タイプ", "format": "select", "currentEnum": []}, "dateValue": {"type": "string", "title": "日付", "format": "datetime", "title_i18n": {"en": "", "ja": ""}}}}, "title": "オープンアクセスの日付", "format": "array"}, "format": {"type": "string", "title": "フォーマット", "format": "text", "title_i18n": {"en": "Format", "ja": "フォーマット"}, "title_i18n_temp": {"en": "Format", "ja": "フォーマット"}}, "groups": {"type": ["null", "string"], "title": "グループ", "format": "select", "currentEnum": []}, "version": {"type": "string", "title": "バージョン情報", "format": "text", "title_i18n": {"en": "Version Information", "ja": "バージョン情報"}, "title_i18n_temp": {"en": "Version Information", "ja": "バージョン情報"}}, "fileDate": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"fileDateType": {"enum": [null, "Accepted", "Collected", "Copyrighted", "Issued", "Submitted", "Updated", "Valid"], "type": ["null", "string"], "title": "日付タイプ", "format": "select", "currentEnum": ["Accepted", "Collected", "Copyrighted", "Issued", "Submitted", "Updated", "Valid"]}, "fileDateValue": {"type": "string", "title": "日付", "format": "datetime", "title_i18n": {"en": "Date", "ja": "日付"}, "title_i18n_temp": {"en": "Date", "ja": "日付"}}}}, "title": "日付", "format": "array"}, "filename": {"type": ["null", "string"], "title": "表示名", "format": "text", "title_i18n": {"en": "FileName", "ja": "表示名"}, "title_i18n_temp": {"en": "FileName", "ja": "表示名"}}, "filesize": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"value": {"type": "string", "title": "サイズ", "format": "text", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}}}, "title": "サイズ", "format": "array"}, "accessrole": {"enum": ["open_access", "open_date", "open_login", "open_no"], "type": ["null", "string"], "title": "アクセス", "format": "radios"}, "displaytype": {"enum": [null, "detail", "simple", "preview"], "type": ["null", "string"], "title": "表示形式", "format": "select", "currentEnum": ["detail", "simple", "preview"]}, "licensefree": {"type": "string", "title": "自由ライセンス", "format": "textarea", "title_i18n": {"en": "自由ライセンス", "ja": "自由ライセンス"}}, "licensetype": {"type": ["null", "string"], "title": "ライセンス", "format": "select", "currentEnum": []}}}, "title": "Co-user List", "maxItems": 9999, "minItems": 1}, "item_1616222047122": {"type": "object", "title": "WF Issued Date", "properties": {"subitem_restricted_access_wf_issued_date": {"type": "string", "title": "WF Issued Date", "format": "datetime", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}, "title_i18n_temp": {"en": "WF Issued Date", "ja": "WF起票日"}}, "subitem_restricted_access_wf_issued_date_type": {"enum": [null, "Created"], "type": ["null", "string"], "title": "WF Issued Date Type", "format": "select", "default": "Created", "currentEnum": ["Created"]}}}, "item_1616222067301": {"type": "object", "title": "Application Date", "properties": {"subitem_restricted_access_application_date": {"type": "string", "title": "Application Date", "format": "datetime", "title_i18n": {"en": "Application Date", "ja": "申請日"}, "title_i18n_temp": {"en": "Application Date", "ja": "申請日"}}, "subitem_restricted_access_application_date_type": {"enum": [null, "Issued"], "type": ["null", "string"], "title": "Application Date Type", "format": "select", "default": "Issued", "currentEnum": ["Issued"]}}}, "item_1616222093486": {"type": "object", "title": "Approval Date", "properties": {"subitem_restricted_access_approval_date": {"type": "string", "title": "Approval Date", "format": "datetime", "title_i18n": {"en": "Approval Date", "ja": "承認日"}, "title_i18n_temp": {"en": "Approval Date", "ja": "承認日"}}, "subitem_restricted_access_approval_date_type": {"enum": [null, "Accepted"], "type": ["null", "string"], "title": "Approval Date Type", "format": "select", "default": "Accepted", "currentEnum": ["Accepted"]}}}, "item_1616222117209": {"type": "object", "title": "Item Title", "properties": {"subitem_restricted_access_item_title": {"type": "string", "title": "Item Title", "format": "text", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}, "title_i18n_temp": {"en": "Item Title", "ja": "アイテムタイトル"}}}}, "system_identifier_doi": {"type": "object", "title": "Persistent Identifier(DOI)", "format": "object", "properties": {"subitem_systemidt_identifier": {"type": "string", "title": "SYSTEMIDT Identifier", "format": "text"}, "subitem_systemidt_identifier_type": {"enum": ["DOI", "HDL", "URI"], "type": "string", "title": "SYSTEMIDT Identifier Type", "format": "select"}}, "system_prop": true}, "system_identifier_hdl": {"type": "object", "title": "Persistent Identifier(HDL)", "format": "object", "properties": {"subitem_systemidt_identifier": {"type": "string", "title": "SYSTEMIDT Identifier", "format": "text"}, "subitem_systemidt_identifier_type": {"enum": ["DOI", "HDL", "URI"], "type": "string", "title": "SYSTEMIDT Identifier Type", "format": "select"}}, "system_prop": true}, "system_identifier_uri": {"type": "object", "title": "Persistent Identifier(URI)", "format": "object", "properties": {"subitem_systemidt_identifier": {"type": "string", "title": "SYSTEMIDT Identifier", "format": "text"}, "subitem_systemidt_identifier_type": {"enum": ["DOI", "HDL", "URI"], "type": "string", "title": "SYSTEMIDT Identifier Type", "format": "select"}}, "system_prop": true}}, "description": ""}
\ No newline at end of file
diff --git a/modules/weko-records-ui/tests/data/itemtype_schema_31002.json b/modules/weko-records-ui/tests/data/itemtype_schema_31002.json
new file mode 100644
index 0000000000..a28db5a8eb
--- /dev/null
+++ b/modules/weko-records-ui/tests/data/itemtype_schema_31002.json
@@ -0,0 +1 @@
+{"type": "object", "$schema": "http://json-schema.org/draft-04/schema#", "required": ["pubdate"], "properties": {"pubdate": {"type": "string", "title": "PubDate", "format": "datetime"}, "system_file": {"type": "object", "title": "File Information", "format": "object", "properties": {"subitem_systemfile_size": {"type": "string", "title": "SYSTEMFILE Size", "format": "text"}, "subitem_systemfile_version": {"type": "string", "title": "SYSTEMFILE Version", "format": "text"}, "subitem_systemfile_datetime": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"subitem_systemfile_datetime_date": {"type": "string", "title": "SYSTEMFILE DateTime Date", "format": "datetime"}, "subitem_systemfile_datetime_type": {"enum": ["Accepted", "Available", "Collected", "Copyrighted", "Created", "Issued", "Submitted", "Updated", "Valid"], "type": "string", "title": "SYSTEMFILE DateTime Type", "format": "select"}}}, "title": "SYSTEMFILE DateTime", "format": "array"}, "subitem_systemfile_filename": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"subitem_systemfile_filename_uri": {"type": "string", "title": "SYSTEMFILE Filename URI", "format": "text"}, "subitem_systemfile_filename_type": {"enum": ["Abstract", "Fulltext", "Summary", "Thumbnail", "Other"], "type": "string", "title": "SYSTEMFILE Filename Type", "format": "select"}, "subitem_systemfile_filename_label": {"type": "string", "title": "SYSTEMFILE Filename Label", "format": "text"}}}, "title": "SYSTEMFILE Filename", "format": "array"}, "subitem_systemfile_mimetype": {"type": "string", "title": "SYSTEMFILE MimeType", "format": "text"}}, "system_prop": true}, "item_1616221831877": {"type": "object", "title": "Dataset Usage", "properties": {"subitem_restricted_access_dataset_usage": {"type": "string", "title": "Dataset Usage", "format": "text", "title_i18n": {"en": "Dataset Usage", "ja": "データ名"}, "title_i18n_temp": {"en": "Dataset Usage", "ja": "データ名"}}}}, "item_1616221851421": {"type": "object", "title": "Applicant", "properties": {"subitem_restricted_access_name": {"type": "string", "title": "Name", "format": "text", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, "subitem_restricted_access_position": {"type": ["null", "string"], "title": "Position", "format": "select", "currentEnum": []}, "subitem_restricted_access_mail_address": {"type": "string", "title": "Mail Address", "format": "text", "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, "subitem_restricted_access_phone_number": {"type": "string", "title": "Phone Number", "format": "text", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}, "subitem_restricted_access_position(others)": {"type": "string", "title": "Position(Others)", "format": "text", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, "subitem_restricted_access_university/institution": {"type": "string", "title": "University/Institution", "format": "text", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, "subitem_restricted_access_affiliated_division/department": {"type": "string", "title": "Affiliated Division/Department", "format": "text", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}}}, "item_1616221894659": {"type": "array", "items": {"type": "object", "properties": {"subitem_restricted_access_institution_name": {"type": "string", "title": "Institution Name", "format": "text", "title_i18n": {"en": "Institution Name", "ja": "所属学会名"}, "title_i18n_temp": {"en": "Institution Name", "ja": "所属学会名"}}, "subitem_restricted_access_institution_position": {"type": ["null", "string"], "title": "Institution Position", "format": "select", "currentEnum": []}}}, "title": "Applicant Affiliated Institution", "maxItems": 9999, "minItems": 1}, "item_1616221902404": {"type": "object", "title": "Guarantor", "properties": {"subitem_restricted_access_guarantor_name": {"type": "string", "title": "Name", "format": "text", "title_i18n": {"en": "Name", "ja": "名前"}, "title_i18n_temp": {"en": "Name", "ja": "名前"}}, "subitem_restricted_access_guarantor_position": {"type": ["null", "string"], "title": "Position", "format": "select", "currentEnum": []}, "subitem_restricted_access_guarantor_mail_address": {"type": "string", "title": "Mail Address", "format": "text", "title_i18n": {"en": "Mail Address", "ja": "メールアドレス"}, "title_i18n_temp": {"en": "Mail Address", "ja": "メールアドレス"}}, "subitem_restricted_access_guarantor_phone_number": {"type": "string", "title": "Phone Number", "format": "text", "title_i18n": {"en": "Phone Number", "ja": "電話番号"}, "title_i18n_temp": {"en": "Phone Number", "ja": "電話番号"}}, "subitem_restricted_access_guarantor_position(others)": {"type": "string", "title": "Position(Others)", "format": "text", "title_i18n": {"en": "Position(Others)", "ja": "役職(その他)"}, "title_i18n_temp": {"en": "Position(Others)", "ja": "役職(その他)"}}, "subitem_restricted_access_guarantor_university/institution": {"type": "string", "title": "University/Institution", "format": "text", "title_i18n": {"en": "University/Institution", "ja": "所属大学・機関"}, "title_i18n_temp": {"en": "University/Institution", "ja": "所属大学・機関"}}, "subitem_restricted_access_guarantor_affiliated_division/department": {"type": "string", "title": "Affiliated Division/Department", "format": "text", "title_i18n": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}, "title_i18n_temp": {"en": "Affiliated Division/Department", "ja": "所属部局・部署"}}}}, "item_1616221921931": {"type": "object", "title": "Usage Report ID", "properties": {"subitem_restricted_access_usage_report_id": {"type": "string", "title": "Usage Report ID", "format": "text", "title_i18n": {"en": "Usage Report ID", "ja": "利用報告ID "}, "title_i18n_temp": {"en": "Usage Report ID", "ja": "利用報告ID "}}}}, "item_1616221941275": {"type": "object", "title": "Research Title", "properties": {"subitem_restricted_access_research_title": {"type": "string", "title": "Research Title", "format": "text", "title_i18n": {"en": "Research Title", "ja": "研究題目"}, "title_i18n_temp": {"en": "Research Title", "ja": "研究題目"}}}}, "item_1616221960771": {"type": "object", "title": "Research Plan", "properties": {"subitem_restricted_access_research_plan": {"type": "string", "title": "Research Plan", "format": "textarea", "title_i18n": {"en": "Research Plan", "ja": "研究計画"}, "title_i18n_temp": {"en": "Research Plan", "ja": "研究計画"}}, "subitem_restricted_access_research_plan_type": {"enum": [null, "Abstract"], "type": ["null", "string"], "title": "Research Plan Type", "format": "select", "default": "Abstract", "currentEnum": ["Abstract"]}}}, "item_1616221987611": {"type": "array", "items": {"type": "object", "properties": {"url": {"type": "object", "title": "本文URL", "format": "object", "properties": {"url": {"type": "string", "title": "本文URL", "format": "text", "title_i18n": {"en": "Text URL", "ja": "本文URL"}, "title_i18n_temp": {"en": "Text URL", "ja": "本文URL"}}, "label": {"type": "string", "title": "ラベル", "format": "text", "title_i18n": {"en": "Label", "ja": "ラベル"}, "title_i18n_temp": {"en": "Label", "ja": "ラベル"}}, "objectType": {"enum": [null, "abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"], "type": ["null", "string"], "title": "オブジェクトタイプ", "format": "select", "currentEnum": ["abstract", "dataset", "fulltext", "software", "summary", "thumbnail", "other"]}}}, "date": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"dateType": {"type": ["null", "string"], "title": "日付タイプ", "format": "select", "currentEnum": []}, "dateValue": {"type": "string", "title": "日付", "format": "datetime", "title_i18n": {"en": "", "ja": ""}}}}, "title": "オープンアクセスの日付", "format": "array"}, "format": {"type": "string", "title": "フォーマット", "format": "text", "title_i18n": {"en": "Format", "ja": "フォーマット"}, "title_i18n_temp": {"en": "Format", "ja": "フォーマット"}}, "groups": {"type": ["null", "string"], "title": "グループ", "format": "select", "currentEnum": []}, "version": {"type": "string", "title": "バージョン情報", "format": "text", "title_i18n": {"en": "Version Information", "ja": "バージョン情報"}, "title_i18n_temp": {"en": "Version Information", "ja": "バージョン情報"}}, "fileDate": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"fileDateType": {"enum": [null, "Accepted", "Collected", "Copyrighted", "Issued", "Submitted", "Updated", "Valid"], "type": ["null", "string"], "title": "日付タイプ", "format": "select", "currentEnum": ["Accepted", "Collected", "Copyrighted", "Issued", "Submitted", "Updated", "Valid"]}, "fileDateValue": {"type": "string", "title": "日付", "format": "datetime", "title_i18n": {"en": "Date", "ja": "日付"}, "title_i18n_temp": {"en": "Date", "ja": "日付"}}}}, "title": "日付", "format": "array"}, "filename": {"type": ["null", "string"], "title": "表示名", "format": "text", "title_i18n": {"en": "FileName", "ja": "表示名"}, "title_i18n_temp": {"en": "FileName", "ja": "表示名"}}, "filesize": {"type": "array", "items": {"type": "object", "format": "object", "properties": {"value": {"type": "string", "title": "サイズ", "format": "text", "title_i18n": {"en": "Size", "ja": "サイズ"}, "title_i18n_temp": {"en": "Size", "ja": "サイズ"}}}}, "title": "サイズ", "format": "array"}, "accessrole": {"enum": ["open_access", "open_date", "open_login", "open_no"], "type": ["null", "string"], "title": "アクセス", "format": "radios"}, "displaytype": {"enum": [null, "detail", "simple", "preview"], "type": ["null", "string"], "title": "表示形式", "format": "select", "currentEnum": ["detail", "simple", "preview"]}, "licensefree": {"type": "string", "title": "自由ライセンス", "format": "textarea", "title_i18n": {"en": "自由ライセンス", "ja": "自由ライセンス"}}, "licensetype": {"type": ["null", "string"], "title": "ライセンス", "format": "select", "currentEnum": []}}}, "title": "Co-user List", "maxItems": 9999, "minItems": 1}, "item_1616222047122": {"type": "object", "title": "WF Issued Date", "properties": {"subitem_restricted_access_wf_issued_date": {"type": "string", "title": "WF Issued Date", "format": "datetime", "title_i18n": {"en": "WF Issued Date", "ja": "WF起票日"}, "title_i18n_temp": {"en": "WF Issued Date", "ja": "WF起票日"}}, "subitem_restricted_access_wf_issued_date_type": {"enum": [null, "Created"], "type": ["null", "string"], "title": "WF Issued Date Type", "format": "select", "default": "Created", "currentEnum": ["Created"]}}}, "item_1616222067301": {"type": "object", "title": "Application Date", "properties": {"subitem_restricted_access_application_date": {"type": "string", "title": "Application Date", "format": "datetime", "title_i18n": {"en": "Application Date", "ja": "申請日"}, "title_i18n_temp": {"en": "Application Date", "ja": "申請日"}}, "subitem_restricted_access_application_date_type": {"enum": [null, "Issued"], "type": ["null", "string"], "title": "Application Date Type", "format": "select", "default": "Issued", "currentEnum": ["Issued"]}}}, "item_1616222093486": {"type": "object", "title": "Approval Date", "properties": {"subitem_restricted_access_approval_date": {"type": "string", "title": "Approval Date", "format": "datetime", "title_i18n": {"en": "Approval Date", "ja": "承認日"}, "title_i18n_temp": {"en": "Approval Date", "ja": "承認日"}}, "subitem_restricted_access_approval_date_type": {"enum": [null, "Accepted"], "type": ["null", "string"], "title": "Approval Date Type", "format": "select", "default": "Accepted", "currentEnum": ["Accepted"]}}}, "item_1616222117209": {"type": "object", "title": "Item Title", "properties": {"subitem_restricted_access_item_title": {"type": "string", "title": "Item Title", "format": "text", "title_i18n": {"en": "Item Title", "ja": "アイテムタイトル"}, "title_i18n_temp": {"en": "Item Title", "ja": "アイテムタイトル"}}}}, "system_identifier_doi": {"type": "object", "title": "Persistent Identifier(DOI)", "format": "object", "properties": {"subitem_systemidt_identifier": {"type": "string", "title": "SYSTEMIDT Identifier", "format": "text"}, "subitem_systemidt_identifier_type": {"enum": ["DOI", "HDL", "URI"], "type": "string", "title": "SYSTEMIDT Identifier Type", "format": "select"}}, "system_prop": true}, "system_identifier_hdl": {"type": "object", "title": "Persistent Identifier(HDL)", "format": "object", "properties": {"subitem_systemidt_identifier": {"type": "string", "title": "SYSTEMIDT Identifier", "format": "text"}, "subitem_systemidt_identifier_type": {"enum": ["DOI", "HDL", "URI"], "type": "string", "title": "SYSTEMIDT Identifier Type", "format": "select"}}, "system_prop": true}, "system_identifier_uri": {"type": "object", "title": "Persistent Identifier(URI)", "format": "object", "properties": {"subitem_systemidt_identifier": {"type": "string", "title": "SYSTEMIDT Identifier", "format": "text"}, "subitem_systemidt_identifier_type": {"enum": ["DOI", "HDL", "URI"], "type": "string", "title": "SYSTEMIDT Identifier Type", "format": "select"}}, "system_prop": true}}, "description": ""}
\ No newline at end of file
diff --git a/modules/weko-records-ui/tests/data/mappings/item-v1.0.0.json b/modules/weko-records-ui/tests/data/mappings/item-v1.0.0.json
index 5f1817ad97..6be4532ab1 100644
--- a/modules/weko-records-ui/tests/data/mappings/item-v1.0.0.json
+++ b/modules/weko-records-ui/tests/data/mappings/item-v1.0.0.json
@@ -156,6 +156,19 @@
}
}
},
+ "request_mail_list": {
+ "type": "nested",
+ "properties": {
+ "author_id": {
+ "type": "keyword",
+ "index": true
+ },
+ "email": {
+ "type": "keyword",
+ "index": true
+ }
+ }
+ },
"alternative": {
"type": "keyword",
"index": true,
diff --git a/modules/weko-records-ui/tests/data/need_restricted_access_records_metadata.json b/modules/weko-records-ui/tests/data/need_restricted_access_records_metadata.json
new file mode 100644
index 0000000000..1916a594f2
--- /dev/null
+++ b/modules/weko-records-ui/tests/data/need_restricted_access_records_metadata.json
@@ -0,0 +1,599 @@
+[
+ {
+ "_oai": {
+ "id": "oai:weko3.example.org:00000011"
+ },
+ "path": [
+ "1557820367608"
+ ],
+ "owner": "5",
+ "recid": "11",
+ "title": [
+ "test1"
+ ],
+ "pubdate": {
+ "attribute_name": "PubDate",
+ "attribute_value": "2023-07-19"
+ },
+ "_buckets": {
+ "deposit": "7a035745-e174-40ab-b936-b9129752671a"
+ },
+ "_deposit": {
+ "id": "11",
+ "pid": {
+ "type": "depid",
+ "value": "11",
+ "revision_id": 0
+ },
+ "owner": "5",
+ "owners": [
+ 5
+ ],
+ "status": "published",
+ "created_by": 5,
+ "owners_ext": {
+ "email": "wekosoftware@nii.ac.jp",
+ "username": "",
+ "displayname": ""
+ }
+ },
+ "item_title": "test1",
+ "author_link": [],
+ "item_type_id": "17",
+ "publish_date": "2023-07-19",
+ "publish_status": "0",
+ "weko_shared_ids": [],
+ "item_1617186331708": {
+ "attribute_name": "Title",
+ "attribute_value_mlt": [
+ {
+ "subitem_1551255647225": "test1",
+ "subitem_1551255648112": "ja"
+ }
+ ]
+ },
+ "item_1617258105262": {
+ "attribute_name": "Resource Type",
+ "attribute_value_mlt": [
+ {
+ "resourceuri": "http://purl.org/coar/resource_type/c_6501",
+ "resourcetype": "journal article"
+ }
+ ]
+ },
+ "item_1689228169922": {
+ "attribute_name": "Restricted",
+ "attribute_type": "file",
+ "attribute_value_mlt": [
+ {
+ "url": {
+ "url": "https://weko3.example.org/record/11/files/dummy.txt"
+ },
+ "date": [
+ {
+ "dateType": "Available",
+ "dateValue": "2023-07-19"
+ }
+ ],
+ "format": "text/plain",
+ "filename": "dummy.txt",
+ "filesize": [
+ {
+ "value": "5 B"
+ }
+ ],
+ "accessrole": "open_access",
+ "version_id": "d7c74a52-f232-427f-a5c8-780ec2e52d35"
+ }
+ ]
+ },
+ "relation_version_is_last": true
+ },
+ {
+ "_oai": {
+ "id": "oai:weko3.example.org:00000012"
+ },
+ "path": [
+ "1557820367608"
+ ],
+ "owner": "2",
+ "recid": "12",
+ "title": [
+ "test2"
+ ],
+ "pubdate": {
+ "attribute_name": "PubDate",
+ "attribute_value": "2023-07-19"
+ },
+ "_buckets": {
+ "deposit": "64368534-3022-4c2e-b667-49df9bc0d1a9"
+ },
+ "_deposit": {
+ "id": "12",
+ "pid": {
+ "type": "depid",
+ "value": "12",
+ "revision_id": 0
+ },
+ "owner": "2",
+ "owners": [
+ 2
+ ],
+ "status": "published",
+ "created_by": 2,
+ "owners_ext": {
+ "email": "wekosoftware@nii.ac.jp",
+ "username": "",
+ "displayname": ""
+ }
+ },
+ "item_title": "test2",
+ "author_link": [],
+ "item_type_id": "17",
+ "publish_date": "2023-07-19",
+ "publish_status": "0",
+ "weko_shared_ids": [],
+ "item_1617186331708": {
+ "attribute_name": "Title",
+ "attribute_value_mlt": [
+ {
+ "subitem_1551255647225": "test2",
+ "subitem_1551255648112": "ja"
+ }
+ ]
+ },
+ "item_1617258105262": {
+ "attribute_name": "Resource Type",
+ "attribute_value_mlt": [
+ {
+ "resourceuri": "http://purl.org/coar/resource_type/c_6501",
+ "resourcetype": "journal article"
+ }
+ ]
+ },
+ "item_1689228169922": {
+ "attribute_name": "Restricted",
+ "attribute_type": "file",
+ "attribute_value_mlt": [
+ {
+ "url": {
+ "url": "https://weko3.example.org/record/12/files/dummy.txt"
+ },
+ "date": [
+ {
+ "dateType": "Available",
+ "dateValue": "2023-07-19"
+ }
+ ],
+ "format": "text/plain",
+ "provide": [
+ {
+ "role": "2",
+ "workflow": "3"
+ },
+ {
+ "role": "none_loggin",
+ "workflow": "3"
+ },
+ {
+ "role": "1",
+ "workflow": "99"
+ },
+ {
+ "role": "3",
+ "workflow": "3"
+ }
+ ],
+ "terms" :"term_free",
+ "termsDescription":"利用規約本文",
+ "terms_content":"利用規約本文",
+ "filename": "dummy.txt",
+ "filesize": [
+ {
+ "value": "5 B"
+ }
+ ],
+ "accessrole": "open_restricted",
+ "version_id": "30c80694-c212-43f0-aa58-d0d0d63c5184"
+ }
+ ]
+ },
+ "relation_version_is_last": true
+ },
+ {
+ "_oai": {
+ "id": "oai:weko3.example.org:00000013"
+ },
+ "path": [
+ "1557820367608"
+ ],
+ "owner": "5",
+ "recid": "13",
+ "title": [
+ "test3"
+ ],
+ "pubdate": {
+ "attribute_name": "PubDate",
+ "attribute_value": "2023-07-19"
+ },
+ "_buckets": {
+ "deposit": "29295268-561d-4498-91af-ee0bd27d4c24"
+ },
+ "_deposit": {
+ "id": "13",
+ "pid": {
+ "type": "depid",
+ "value": "13",
+ "revision_id": 0
+ },
+ "owner": "5",
+ "owners": [
+ 5
+ ],
+ "status": "published",
+ "created_by": 5,
+ "owners_ext": {
+ "email": "wekosoftware@nii.ac.jp",
+ "username": "",
+ "displayname": ""
+ }
+ },
+ "item_title": "test3",
+ "author_link": [],
+ "item_type_id": "17",
+ "publish_date": "2023-07-19",
+ "publish_status": "0",
+ "weko_shared_ids": [],
+ "item_1617186331708": {
+ "attribute_name": "Title",
+ "attribute_value_mlt": [
+ {
+ "subitem_1551255647225": "test3",
+ "subitem_1551255648112": "ja"
+ }
+ ]
+ },
+ "item_1617258105262": {
+ "attribute_name": "Resource Type",
+ "attribute_value_mlt": [
+ {
+ "resourceuri": "http://purl.org/coar/resource_type/c_6501",
+ "resourcetype": "journal article"
+ }
+ ]
+ },
+ "item_1689228169922": {
+ "attribute_name": "Restricted",
+ "attribute_type": "file",
+ "attribute_value_mlt": [
+ {
+ "url": {
+ "url": "https://weko3.example.org/record/13/files/dummy.txt"
+ },
+ "date": [
+ {
+ "dateType": "Available",
+ "dateValue": "2023-07-19"
+ }
+ ],
+ "format": "text/plain",
+ "provide": [
+ {
+ "role": "2",
+ "workflow": "3"
+ }
+ ],
+ "terms" :"term_free",
+ "termsDescription":"利用規約本文",
+ "terms_content":"利用規約本文",
+ "filename": "dummy.txt",
+ "filesize": [
+ {
+ "value": "5 B"
+ }
+ ],
+ "accessrole": "open_restricted",
+ "version_id": "12634dbe-2b8d-46ad-b3c9-6cc8e55b1273"
+ }
+ ]
+ },
+ "relation_version_is_last": true
+ },
+ {
+ "_oai": {
+ "id": "oai:weko3.example.org:00000014"
+ },
+ "path": [
+ "1557820367608"
+ ],
+ "owner": "5",
+ "recid": "14",
+ "title": [
+ "test4"
+ ],
+ "pubdate": {
+ "attribute_name": "PubDate",
+ "attribute_value": "2023-07-19"
+ },
+ "_buckets": {
+ "deposit": "d94a7763-74a0-4567-9e20-6937eed6c959"
+ },
+ "_deposit": {
+ "id": "14",
+ "pid": {
+ "type": "depid",
+ "value": "14",
+ "revision_id": 0
+ },
+ "owner": "5",
+ "owners": [
+ 5
+ ],
+ "status": "published",
+ "created_by": 5,
+ "owners_ext": {
+ "email": "wekosoftware@nii.ac.jp",
+ "username": "",
+ "displayname": ""
+ }
+ },
+ "item_title": "test4",
+ "author_link": [],
+ "item_type_id": "17",
+ "publish_date": "2023-07-19",
+ "publish_status": "0",
+ "weko_shared_ids": [],
+ "item_1617186331708": {
+ "attribute_name": "Title",
+ "attribute_value_mlt": [
+ {
+ "subitem_1551255647225": "test4",
+ "subitem_1551255648112": "ja"
+ }
+ ]
+ },
+ "item_1617258105262": {
+ "attribute_name": "Resource Type",
+ "attribute_value_mlt": [
+ {
+ "resourceuri": "http://purl.org/coar/resource_type/c_6501",
+ "resourcetype": "journal article"
+ }
+ ]
+ },
+ "item_1689228169922": {
+ "attribute_name": "Restricted",
+ "attribute_type": "file",
+ "attribute_value_mlt": [
+ {
+ "url": {
+ "url": "https://weko3.example.org/record/14/files/dummy.txt"
+ },
+ "date": [
+ {
+ "dateType": "Available",
+ "dateValue": "2023-07-19"
+ }
+ ],
+ "format": "text/plain",
+ "provide": [
+ {
+ "role": "2",
+ "workflow": "3"
+ }
+ ],
+ "terms" :"term_free",
+ "termsDescription":"利用規約本文",
+ "terms_content":"利用規約本文",
+ "filename": "dummy.txt",
+ "filesize": [
+ {
+ "value": "5 B"
+ }
+ ],
+ "accessrole": "open_restricted",
+ "version_id": "9ce83540-96ec-4c0f-9764-8650a0b15907"
+ }
+ ]
+ },
+ "relation_version_is_last": true
+ },
+ {
+ "_oai": {
+ "id": "oai:weko3.example.org:00000015"
+ },
+ "path": [
+ "1557820367608"
+ ],
+ "owner": "5",
+ "recid": "15",
+ "title": [
+ "test6"
+ ],
+ "pubdate": {
+ "attribute_name": "PubDate",
+ "attribute_value": "2023-07-19"
+ },
+ "_buckets": {
+ "deposit": "40656af4-41da-4359-a157-325e0862946d"
+ },
+ "_deposit": {
+ "id": "15",
+ "pid": {
+ "type": "depid",
+ "value": "15",
+ "revision_id": 0
+ },
+ "owner": "5",
+ "owners": [
+ 5
+ ],
+ "status": "published",
+ "created_by": 5,
+ "owners_ext": {
+ "email": "wekosoftware@nii.ac.jp",
+ "username": "",
+ "displayname": ""
+ }
+ },
+ "item_title": "test5",
+ "author_link": [],
+ "item_type_id": "17",
+ "publish_date": "2023-07-19",
+ "publish_status": "0",
+ "weko_shared_ids": [],
+ "item_1617186331708": {
+ "attribute_name": "Title",
+ "attribute_value_mlt": [
+ {
+ "subitem_1551255647225": "test5",
+ "subitem_1551255648112": "ja"
+ }
+ ]
+ },
+ "item_1617258105262": {
+ "attribute_name": "Resource Type",
+ "attribute_value_mlt": [
+ {
+ "resourceuri": "http://purl.org/coar/resource_type/c_6501",
+ "resourcetype": "journal article"
+ }
+ ]
+ },
+ "item_1689228169922": {
+ "attribute_name": "Restricted",
+ "attribute_type": "file",
+ "attribute_value_mlt": [
+ {
+ "url": {
+ "url": "https://weko3.example.org/record/15/files/dummy.txt"
+ },
+ "date": [
+ {
+ "dateType": "Available",
+ "dateValue": "2023-07-19"
+ }
+ ],
+ "format": "text/plain",
+ "provide": [
+ {
+ "role": "2",
+ "workflow": "3"
+ }
+ ],
+ "terms" :"term_free",
+ "termsDescription":"利用規約本文",
+ "terms_content":"利用規約本文",
+ "filename": "dummy.txt",
+ "filesize": [
+ {
+ "value": "5 B"
+ }
+ ],
+ "accessrole": "open_restricted",
+ "version_id": "37790b92-d50c-4a83-ae82-713de1857fca"
+ }
+ ]
+ },
+ "relation_version_is_last": true
+ },
+ {
+ "_oai": {
+ "id": "oai:weko3.example.org:00000016"
+ },
+ "path": [
+ "1557820367608"
+ ],
+ "owner": "5",
+ "recid": "16",
+ "title": [
+ "test6"
+ ],
+ "pubdate": {
+ "attribute_name": "PubDate",
+ "attribute_value": "2023-07-19"
+ },
+ "_buckets": {
+ "deposit": "9d4dab27-e79a-40ff-aefa-1d91d160dd00"
+ },
+ "_deposit": {
+ "id": "16",
+ "pid": {
+ "type": "depid",
+ "value": "16",
+ "revision_id": 0
+ },
+ "owner": "5",
+ "owners": [
+ 5
+ ],
+ "status": "published",
+ "created_by": 5,
+ "owners_ext": {
+ "email": "wekosoftware@nii.ac.jp",
+ "username": "",
+ "displayname": ""
+ }
+ },
+ "item_title": "test6",
+ "author_link": [],
+ "item_type_id": "17",
+ "publish_date": "2023-07-19",
+ "publish_status": "0",
+ "weko_shared_ids": [],
+ "item_1617186331708": {
+ "attribute_name": "Title",
+ "attribute_value_mlt": [
+ {
+ "subitem_1551255647225": "test6",
+ "subitem_1551255648112": "ja"
+ }
+ ]
+ },
+ "item_1617258105262": {
+ "attribute_name": "Resource Type",
+ "attribute_value_mlt": [
+ {
+ "resourceuri": "http://purl.org/coar/resource_type/c_6501",
+ "resourcetype": "journal article"
+ }
+ ]
+ },
+ "item_1689228169922": {
+ "attribute_name": "Restricted",
+ "attribute_type": "file",
+ "attribute_value_mlt": [
+ {
+ "url": {
+ "url": "https://weko3.example.org/record/16/files/dummy.txt"
+ },
+ "date": [
+ {
+ "dateType": "Available",
+ "dateValue": "2023-07-19"
+ }
+ ],
+ "format": "text/plain",
+ "provide": [
+ {
+ "role": "2",
+ "workflow": "3"
+ }
+ ],
+ "terms" :"term_free",
+ "termsDescription":"利用規約本文",
+ "terms_content":"利用規約本文",
+ "filename": "dummy.txt",
+ "filesize": [
+ {
+ "value": "5 B"
+ }
+ ],
+ "accessrole": "open_restricted",
+ "version_id": "4e3fd7f4-9326-4d2c-842a-df6b84e02254"
+ }
+ ]
+ },
+ "relation_version_is_last": true
+ }
+]
\ No newline at end of file
diff --git a/modules/weko-records-ui/tests/helpers.py b/modules/weko-records-ui/tests/helpers.py
new file mode 100644
index 0000000000..262f747c37
--- /dev/null
+++ b/modules/weko-records-ui/tests/helpers.py
@@ -0,0 +1,10 @@
+import copy
+
+
+def fill_oauth2_headers(json_headers, token):
+ """Create authentication headers (with a valid oauth2 token)."""
+ headers = copy.deepcopy(json_headers)
+ headers.append(
+ ('Authorization', 'Bearer {0}'.format(token.access_token))
+ )
+ return headers
diff --git a/modules/weko-records-ui/tests/test_admin.py b/modules/weko-records-ui/tests/test_admin.py
index decd46e3e2..1d269ee7cf 100644
--- a/modules/weko-records-ui/tests/test_admin.py
+++ b/modules/weko-records-ui/tests/test_admin.py
@@ -38,6 +38,10 @@ def test_index(self,app,client,db_sessionlifetime,users,db_admin_settings):
data = {"submit": "a"}
res = client.post(url,data=data)
assert res.status == '200 OK'
+
+ with patch("weko_records_ui.admin.check_items_settings", side_effect = BaseException()):
+ res = client.post(url,data=data)
+ assert res.status == '400 BAD REQUEST'
data = {"submit": "set_search_author_form","displayRadios":"1", "openDateDisplayRadios":"1"}
res = client.post(url,data=data)
diff --git a/modules/weko-records-ui/tests/test_api.py b/modules/weko-records-ui/tests/test_api.py
new file mode 100644
index 0000000000..2f52f0b73f
--- /dev/null
+++ b/modules/weko-records-ui/tests/test_api.py
@@ -0,0 +1,247 @@
+from smtplib import SMTPException
+from mock import patch
+import pytest
+from flask import current_app
+import uuid
+from pytest_mock import mocker
+from sqlalchemy.exc import SQLAlchemyError
+
+from weko_records.models import ItemApplication
+from weko_records_ui.api import send_request_mail, create_captcha_image, get_item_provide_list, validate_captcha_answer
+from weko_records_ui.api import send_request_mail, create_captcha_image
+from weko_records_ui.errors import AuthenticationRequiredError, ContentsNotFoundError, InternalServerError, InvalidCaptchaError, InvalidEmailError, RequiredItemNotExistError
+from weko_redis.redis import RedisConnection
+
+# def send_request_mail(item_id, mail_info):
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_api.py::test_send_request_mail -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_send_request_mail(app, make_request_maillist):
+
+ redis_connection = RedisConnection()
+ datastore = redis_connection.connection(db=app.config['CACHE_REDIS_DB'])
+ datastore.hmset(b'test_key',{b'authorization_token':b'token'})
+
+ correct_mail_info = {
+ 'from': 'test1@example.com',
+ 'subject': 'test_subject',
+ 'message': 'test_message',
+ 'key': 'test_key',
+ 'authorization_token': 'token'
+ }
+
+ # TestCase: missing 'key' in request body
+ item_id = make_request_maillist[0]
+ with pytest.raises(RequiredItemNotExistError):
+ send_request_mail(item_id, {
+ 'from': 'test1@example.com',
+ 'subject': 'test_subject',
+ 'message': 'test_message',
+ 'authorization_token': 'token'})
+
+ # TestCase: 'key' is empty
+ item_id = make_request_maillist[0]
+ with pytest.raises(RequiredItemNotExistError):
+ send_request_mail(item_id, {
+ 'from': 'test1@example.com',
+ 'subject': 'test_subject',
+ 'message': 'test_message',
+ 'key': '',
+ 'authorization_token': 'token'})
+
+ # TestCase: missing 'authorization_token' in reuqest body
+ item_id = make_request_maillist[0]
+ with pytest.raises(RequiredItemNotExistError):
+ send_request_mail(item_id, {
+ 'from': 'test1@example.com',
+ 'subject': 'test_subject',
+ 'message': 'test_message',
+ 'key': 'test_key'})
+
+ # TestCase: empty 'authorization_token'
+ item_id = make_request_maillist[0]
+ with pytest.raises(RequiredItemNotExistError):
+ send_request_mail(item_id, {
+ 'from': 'test1@example.com',
+ 'subject': 'test_subject',
+ 'message': 'test_message',
+ 'key': 'test_key',
+ 'authorization_token': ''})
+
+ # TestCase: 'authorization_token' is wrong
+ item_id = make_request_maillist[0]
+ with pytest.raises(AuthenticationRequiredError):
+ send_request_mail(item_id, {
+ 'from': 'test1@example.com',
+ 'subject': 'test_subject',
+ 'message': 'test_message',
+ 'key': 'test_key',
+ 'authorization_token': 'token1'})
+
+ # TestCase: Empty mail list
+ item_id = make_request_maillist[1]
+ with pytest.raises(ContentsNotFoundError):
+ send_request_mail(item_id, correct_mail_info)
+
+ # TestCase: missing 'from' in request body
+ item_id = make_request_maillist[0]
+ with pytest.raises(RequiredItemNotExistError):
+ send_request_mail(item_id, {
+ 'subject': 'test_subject',
+ 'message': 'test_message',
+ 'key': 'test_key',
+ 'authorization_token': 'token'})
+
+ # TestCase: 'from' is empty
+ item_id = make_request_maillist[0]
+ with pytest.raises(RequiredItemNotExistError):
+ send_request_mail(item_id, {
+ 'from': '',
+ 'subject': 'test_subject',
+ 'message': 'test_message',
+ 'key': 'test_key',
+ 'authorization_token': 'token'})
+
+ # TestCase: Invalid 'from' format
+ item_id = make_request_maillist[0]
+
+ with pytest.raises(InvalidEmailError):
+ send_request_mail(item_id, {
+ 'from': 'あああああ',
+ 'subject': 'test_subject',
+ 'message': 'test_message',
+ 'key': 'test_key',
+ 'authorization_token': 'token'})
+
+ # TestCase: missing 'subject' in request body
+ item_id = make_request_maillist[0]
+ with pytest.raises(RequiredItemNotExistError):
+ send_request_mail(item_id, {
+ 'from': 'test1@example.com',
+ 'message': 'test_message',
+ 'key': 'test_key',
+ 'authorization_token': 'token'})
+
+ # TestCase: 'subject' is empty
+ item_id = make_request_maillist[0]
+ with pytest.raises(RequiredItemNotExistError):
+ send_request_mail(item_id, {
+ 'from': 'test1@example.com',
+ 'subject': '',
+ 'message': 'test_message',
+ 'key': 'test_key',
+ 'authorization_token': 'token'})
+
+ # TestCase: missing 'message' in reuqest body
+ item_id = make_request_maillist[0]
+ with pytest.raises(RequiredItemNotExistError):
+ send_request_mail(item_id, {
+ 'from': 'test1@example.com',
+ 'subject': 'test_subject',
+ 'key': 'test_key',
+ 'authorization_token': 'token'})
+
+ # TestCase: empty 'message'
+ item_id = make_request_maillist[0]
+ with pytest.raises(RequiredItemNotExistError):
+ send_request_mail(item_id, {
+ 'from': 'test1@example.com',
+ 'subject': 'test_subject',
+ 'message': '',
+ 'key': 'test_key',
+ 'authorization_token': 'token'})
+
+ # TestCase: Request Mail Successful
+ #mocker.patch('flask_mail._Mail.send')
+ item_id = make_request_maillist[0]
+ msg_body = correct_mail_info['from'] + current_app.config.get("WEKO_RECORDS_UI_REQUEST_MESSAGE") + correct_mail_info['message']
+ res_test ={
+ "from": correct_mail_info['from'],
+ "subject": correct_mail_info['subject'],
+ "message": msg_body
+ }
+ with app.test_request_context():
+ with patch ("flask_mail._Mail.send"):
+ status, response = send_request_mail(item_id, correct_mail_info)
+ assert status == True
+ assert response == res_test
+
+ # TestCase: exception occured
+ item_id = make_request_maillist[0]
+ with app.test_request_context():
+ with patch("flask_mail._Mail.send", side_effect=SMTPException):
+ with pytest.raises(InternalServerError):
+ send_request_mail(item_id, correct_mail_info)
+
+
+# def validate_captcha_answer(captcha_answer):
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_api.py::test_validate_captcha_answer -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_validate_captcha_answer(app):
+
+ redis_connection = RedisConnection()
+ datastore = redis_connection.connection(db=app.config['CACHE_REDIS_DB'])
+
+ datastore.hmset(b'test_key',{b'calculation_result':b'100'})
+
+ # TestCase: missing 'key' in request body
+ with pytest.raises(RequiredItemNotExistError):
+ validate_captcha_answer({
+ 'calculation_result': 100
+ })
+
+ # TestCase: empty 'key' in request body
+ with pytest.raises(RequiredItemNotExistError):
+ validate_captcha_answer({
+ 'key': '',
+ 'calculation_result': 100
+ })
+
+ # TestCase: missing 'calculation_result' in request body
+ with pytest.raises(RequiredItemNotExistError):
+ validate_captcha_answer({
+ 'key': 'test_key'
+ })
+
+ # TestCase: wrong 'calculation_result'
+ datastore.hmset(b'test_key',{b'calculation_result':b'100'})
+ with pytest.raises(InvalidCaptchaError):
+ validate_captcha_answer({
+ 'key': 'test_key',
+ 'calculation_result': 99
+ })
+ # check redis is empty
+ captcha_info = datastore.hgetall('test_key')
+ assert captcha_info == {}
+
+ # TestCase: correct calculation result
+ datastore.hmset(b'test_key',{b'calculation_result':b'100'})
+ status, response = validate_captcha_answer({
+ 'key': 'test_key',
+ 'calculation_result': 100
+ })
+ assert status == True
+ assert 'authorization_token' in response.keys()
+# def create_captcha_image(item_id, mail_info):
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_api.py::test_create_captcha_image -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_create_captcha_image(app):
+ with app.test_request_context():
+ status, response = create_captcha_image()
+ assert status == True
+ assert 'key' in response.keys()
+ assert 'image' in response.keys()
+ assert response.get('ttl') == 600
+# def get_item_provide_list(item_id):
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_api.py::test_get_item_provide_list -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_get_item_provide_list(mocker, db):
+ assert get_item_provide_list(None)=={}
+ item_id_1 = uuid.uuid4()
+ item_id_2 = uuid.uuid4()
+ item_application_1 = ItemApplication(id = 1, item_id = item_id_1, item_application = {"workflow":"1", "terms":"term_free", "termsDescription":"利用規約自由入力"})
+
+ with db.session.begin_nested():
+ db.session.add(item_application_1)
+ db.session.commit()
+ assert get_item_provide_list(item_id_1) == {"workflow":"1", "terms":"term_free", "termsDescription":"利用規約自由入力"}
+ assert get_item_provide_list(item_id_2) == {}
+
+ # error
+ mocker.patch("flask_sqlalchemy.BaseQuery.first", side_effect=SQLAlchemyError)
+ assert get_item_provide_list(item_id_1) == {}
\ No newline at end of file
diff --git a/modules/weko-records-ui/tests/test_captcha.py b/modules/weko-records-ui/tests/test_captcha.py
new file mode 100644
index 0000000000..9ee34a0d5e
--- /dev/null
+++ b/modules/weko-records-ui/tests/test_captcha.py
@@ -0,0 +1,73 @@
+from mock import patch
+from unittest.mock import MagicMock
+import pytest
+import io
+import random
+from flask import Flask, json, jsonify, session, url_for, current_app
+from flask_security.utils import login_user
+from invenio_accounts.testutils import login_user_via_session
+from weko_records_ui.captcha import ImageCaptchaEx, get_captcha_info
+from captcha.image import random_color
+from PIL.Image import new as createImage, Image, QUAD, BILINEAR
+from PIL.ImageDraw import Draw, ImageDraw
+from PIL.ImageFilter import SMOOTH
+
+
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_captcha.py::test_create_captcha_image -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko_records_ui/.tox/c1/tmp
+def test_create_captcha_image(mocker):
+ imagechan = ImageCaptchaEx(width=360, height=78)
+ chars = "1a2b+4c5"
+ color = (10,200,225)
+ background = (240,240,240)
+ with patch("weko_records_ui.captcha.random.random", return_value=0.7):
+ print(type(imagechan.create_captcha_image(chars, color, background)))
+ print(type(Image()))
+ assert type(Image()) == type(imagechan.create_captcha_image(chars, color, background))
+ with patch("weko_records_ui.captcha.random.random", return_value=0.3):
+ assert type(Image()) == type(imagechan.create_captcha_image(chars, color, background))
+
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_captcha.py::test_generate_image -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko_records_ui/.tox/c1/tmp
+def test_generate_image(mocker):
+ imagechan = ImageCaptchaEx(width=360, height=78)
+ chars = "1a2b+4c5"
+ with mocker.patch("weko_records_ui.captcha.random.random", return_value=0.7):
+ assert type(Image()) == type(imagechan.generate_image(chars))
+
+counter = 0
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_captcha.py::test_get_captcha_info -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko_records_ui/.tox/c1/tmp
+def test_get_captcha_info(mocker):
+ def side_effect1(one=None,two=None):
+ global counter
+ counter += 1
+ if counter > 2:
+ return 10
+ elif counter == 1:
+ return 50
+ elif counter == 2:
+ return 30
+ def side_effect2(one=None,two=None):
+ global counter
+ counter += 1
+ if counter > 2:
+ return 10
+ elif counter == 1:
+ return 30
+ elif counter == 2:
+ return 50
+
+ with patch("weko_records_ui.captcha.random.randint") as r:
+ with patch("weko_records_ui.captcha.random.random", return_value=0.7):
+ r.side_effect = side_effect1
+ ret = get_captcha_info()
+ assert type(bytes()) == type(ret["image"])
+ assert type(int()) == type(ret["answer"])
+ r.side_effect = side_effect2
+ ret = get_captcha_info()
+ assert type(bytes()) == type(ret["image"])
+ assert type(int()) == type(ret["answer"])
+ with patch("weko_records_ui.captcha.random.random", return_value=0.3):
+ r.side_effect = side_effect1
+ ret = get_captcha_info()
+ assert type(bytes()) == type(ret["image"])
+ assert type(int()) == type(ret["answer"])
+
diff --git a/modules/weko-records-ui/tests/test_errors.py b/modules/weko-records-ui/tests/test_errors.py
new file mode 100755
index 0000000000..104f5798f5
--- /dev/null
+++ b/modules/weko-records-ui/tests/test_errors.py
@@ -0,0 +1,39 @@
+from mock import patch
+from unittest.mock import MagicMock
+import pytest
+import io
+from flask import Flask, json, jsonify, session, url_for
+from flask_security.utils import login_user
+from invenio_accounts.testutils import login_user_via_session
+
+from weko_records_ui.errors import InvalidWorkflowError
+from flask_babelex import get_locale
+
+class MockLocale():
+ def __init__(self, return_value):
+ self.return_value= return_value
+
+ def get_language_name(self, lang):
+ return self.return_value
+
+#.tox/c1/bin/pytest --cov=weko_records_ui tests/test_errors.py::test_get_this_message -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_get_this_message(app):
+ locale = ""
+ restricted_error_msg = {"key" : "","content" : {"ja" : {"content" : "このデータは利用できません(権限がないため)。"},"en":{"content" : "This data is not available for this user"}}}
+ #test No.4(W2023-22 3-5)
+ with app.app_context():
+ mock_locale = MockLocale("English")
+ with patch("weko_records_ui.errors.get_locale", return_value=mock_locale):
+ with patch("weko_admin.utils.get_restricted_access", return_value = restricted_error_msg):
+ error = InvalidWorkflowError()
+ result = error.get_this_message()
+ assert result == restricted_error_msg['content']['en']['content']
+
+ #test No.5(W2023-22 3-5)
+ with app.app_context():
+ mock_locale = MockLocale("Japanese")
+ with patch("weko_records_ui.errors.get_locale", return_value=mock_locale):
+ with patch("weko_admin.utils.get_restricted_access", return_value = restricted_error_msg):
+ error = InvalidWorkflowError()
+ result = error.get_this_message()
+ assert result == restricted_error_msg['content']['ja']['content']
\ No newline at end of file
diff --git a/modules/weko-records-ui/tests/test_fd.py b/modules/weko-records-ui/tests/test_fd.py
index 391b211d1a..e6c6f47d34 100644
--- a/modules/weko-records-ui/tests/test_fd.py
+++ b/modules/weko-records-ui/tests/test_fd.py
@@ -1,6 +1,10 @@
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_fd.py -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
-from weko_records_ui.fd import prepare_response,file_download_onetime,_download_file,add_signals_info,weko_view_method,file_ui,file_preview_ui,file_download_ui
+import re
+from flask_login import current_user
+from requests import Response
+from weko_deposit.api import WekoFileObject
+from weko_records_ui.fd import _is_terms_of_use_only, file_download_secret, prepare_response,file_download_onetime,_download_file,add_signals_info,weko_view_method,file_ui,file_preview_ui,file_download_ui
from weko_records_ui.config import WEKO_RECORDS_UI_DETAIL_TEMPLATE
from unittest.mock import MagicMock
from invenio_theme.config import THEME_ERROR_TEMPLATE
@@ -8,12 +12,16 @@
import io
import copy
from flask import Flask, json, jsonify, session, url_for,request
+from flask import url_for,current_app,make_response
from flask_security.utils import login_user
from invenio_accounts.testutils import login_user_via_session
from mock import patch
from invenio_records_files.utils import record_file_factory
-from werkzeug.exceptions import NotFound
+from werkzeug.exceptions import NotFound ,Forbidden
+from weko_admin.models import AdminSettings
+from weko_records_ui.models import FileSecretDownload
+from sqlalchemy.exc import SQLAlchemyError
# def weko_view_method(pid, record, template=None, **kwargs):
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_fd.py::test_weko_view_method -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
def test_weko_view_method(app,records,itemtypes,users):
@@ -72,7 +80,7 @@ def test_file_download_ui(app,records,itemtypes,users):
# def file_ui(
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_fd.py::test_file_ui -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
-def test_file_ui(app,records,itemtypes,users):
+def test_file_ui(app,records,itemtypes,users,mocker):
indexer, results = records
recid = results[0]["recid"]
record = results[0]["record"]
@@ -100,6 +108,7 @@ def can():
data3.can = can
data3.obj = 1
+
with app.test_request_context():
# with patch("weko_records_ui.fd.file_permission_factory", return_value=data3):
# with patch("weko_records_ui.fd.record_file_factory", return_value=data3):
@@ -115,6 +124,88 @@ def can():
file_ui(data2, data3)
except:
pass
+
+
+# def file_ui(
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_fd.py::test_file_ui2 -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_file_ui2(app,records_restricted,itemtypes,users ,client ,mocker):
+ indexer, results = records_restricted
+ recid_none_login = results[len(results) -2]["recid"]
+ recid_login = results[len(results) -1]["recid"]
+ # 21
+ # with app.test_request_context():
+ mock= mocker.patch('weko_records_ui.fd._download_file' ,return_value=make_response())
+ res = client.get(url_for('invenio_records_ui.recid_files'
+ , pid_value = recid_none_login.pid_value
+ , filename = "helloworld_open_restricted.pdf"
+ ) + "?terms_of_use_only=true")
+ assert res.status == '200 OK'
+ assert mock.call_count == 1
+ #22
+ data1 = MagicMock()
+ def cannot():
+ return False
+ data1.can = cannot
+ mock = mocker.patch('weko_records_ui.fd._redirect_method' ,return_value=make_response())
+ with patch('weko_records_ui.fd.file_permission_factory', return_value=data1):
+ res = client.get(url_for('invenio_records_ui.recid_files'
+ , pid_value = recid_none_login.pid_value
+ , filename = "helloworld_open_restricted.pdf"
+ ))
+ assert res.status == '200 OK'
+ assert mock.call_count == 1
+
+ with patch("weko_records_ui.fd.file_permission_factory", return_value=data1):
+ with patch("flask_login.utils._get_user", return_value=users[7]["obj"]):
+ indexer, results = records_restricted
+ recid_none_login = results[len(results) -2]["recid"]
+ recid_login = results[len(results) -1]["recid"]
+ record_login = results[len(results) -1]["record"]
+
+ from werkzeug.exceptions import Forbidden
+ try:
+ res = file_ui(recid_login,record_login ,is_preview=False , filename = "helloworld_open_restricted.pdf")
+ assert False
+ except Forbidden :
+ pass
+
+# def file_ui(
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_fd.py::test_file_ui3 -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_file_ui3(app,records_restricted,itemtypes,db_file_permission,users ,client ,mocker):
+ indexer, results = records_restricted
+ recid_none_login = results[len(results) -2]["recid"]
+ recid_login = results[len(results) -1]["recid"]
+ record_login = results[len(results) -1]["record"]
+ data1 = MagicMock()
+ def can():
+ return True
+ data1.can = can
+
+ with app.test_request_context():
+ with patch('weko_records_ui.fd.file_permission_factory', return_value=data1):
+ #23
+ # contributer logined
+ with patch("flask_login.utils._get_user", return_value=users[0]["obj"]):
+ mock = mocker.patch('weko_records_ui.fd.file_download_onetime' ,return_value=make_response())
+ fileobj:WekoFileObject = record_file_factory( recid_login, record_login, filename = "helloworld_open_restricted.pdf" )
+ fileobj.data['accessrole']='open_restricted'
+ fileobj.data['filename'] = "helloworld_open_restricted.pdf"
+ res = file_ui(recid_login,record_login ,is_preview=False , filename = "helloworld_open_restricted.pdf")
+ mock.assert_called()
+
+ #24
+ with patch("flask_login.utils._get_user", return_value=users[7]["obj"]):
+ with patch("weko_records_ui.fd.is_owners_or_superusers", return_value=False):
+ fileobj:WekoFileObject = record_file_factory( recid_login, record_login, filename = "helloworld_open_restricted.pdf" )
+ fileobj.data['accessrole']='open_restricted'
+ fileobj.data['filename'] = "helloworld_open_restricted.pdf"
+ from werkzeug.exceptions import Forbidden
+ try:
+ res = file_ui(recid_login,record_login ,is_preview=False , filename = "helloworld_open_restricted.pdf")
+ assert False
+ except Forbidden :
+ pass
+
# def _download_file(file_obj, is_preview, lang, obj, pid, record):
@@ -175,20 +266,181 @@ def test_file_download_onetime(app, records, itemtypes, users, db_fileonetimedow
indexer, results = records
recid = results[0]["recid"]
record = results[0]["record"]
+ mailaddress = "user@email"
app.config["THEME_ERROR_TEMPLATE"]=THEME_ERROR_TEMPLATE
with app.test_request_context('?token=MSB1c2VyQGV4YW1wbGUub3JnIDIwMjItMDktMjcgNDBDRkNGODFGM0FFRUI0Ng=='):
- with patch("flask_login.utils._get_user", return_value=users[1]["obj"]):
+ with patch("weko_records_ui.fd.redirect", return_value=""):
+ assert file_download_onetime(recid,record,record_file_factory)==""
+ with app.test_request_context('?token=MSB1c2VyQGV4YW1wbGUub3JnIDIwMjItMDktMjcgNDBDRkNGODFGM0FFRUI0Ng==&mailaddress='+ mailaddress + '&isajax=true'):
with patch("flask.templating._render", return_value=""):
with patch("weko_records_ui.fd.get_onetime_download", return_value=db_fileonetimedownload):
- _rv = (True, "")
- with patch("weko_records_ui.fd.validate_onetime_download_token", return_value=_rv):
- assert file_download_onetime(recid,record,record_file_factory)==""
+ with patch("weko_records_ui.fd.parse_one_time_download_token", return_value=(True, [1])):
+ assert file_download_onetime(recid,record,record_file_factory)==(True,401)
+
+ with patch("weko_records_ui.fd.parse_one_time_download_token", return_value=(False, ("","","",""))):
- with patch("weko_records_ui.fd.parse_one_time_download_token", return_value=(True, [1])):
- assert file_download_onetime(recid,record,record_file_factory)==""
+ with patch("weko_records_ui.fd.validate_onetime_download_token", return_value=(False, [1])):
+ assert file_download_onetime(recid,record,record_file_factory)==([1],401)
- with patch("weko_records_ui.fd.validate_onetime_download_token", return_value=(False, [1])):
- assert file_download_onetime(recid,record,record_file_factory)==""
+ _rv = (True, "")
+ with patch("weko_records_ui.fd.validate_onetime_download_token", return_value=_rv):
+ assert file_download_onetime(recid,record,record_file_factory)==('Unexpected error occurred.',401)
+
+ with patch("weko_records_ui.fd.record_file_factory", return_value=False):
+ assert file_download_onetime(recid,record,None)==('None does not exist.', 401)
+
+ file_object = MagicMock()
+ file_object.obj = {"foo" : "hoge"}
+ file_object.get = lambda x : 'open_restricted'
+ with patch("weko_records_ui.fd.record_file_factory", return_value=file_object):
+ with patch('weko_records_ui.fd.check_and_send_usage_report',return_value ="error"):
+ assert file_download_onetime(recid,record,None)==('error',401)
+ with patch('weko_records_ui.fd.check_and_send_usage_report',side_effect = BaseException ):
+ assert file_download_onetime(recid,record,None)==('Unexpected error occurred.', 401)
+ with patch('weko_records_ui.fd.check_and_send_usage_report',side_effect =SQLAlchemyError):
+ assert file_download_onetime(recid,record,None)==('Unexpected error occurred.', 401)
+ with patch('weko_records_ui.fd.check_and_send_usage_report',return_value =""):
+ with patch('weko_records_ui.fd.update_onetime_download',return_value =True):
+ with patch("weko_records_ui.fd.parse_one_time_download_token", return_value=(False, ("","","",""))):
+ assert file_download_onetime(recid,record,None)==('Could not download file.', 401)
+ user_mail = "user@email"
+ with patch("weko_records_ui.fd.parse_one_time_download_token", return_value=(False, ("",user_mail,"",""))):
+ with patch('weko_records_ui.fd._download_file',return_value ="downloaded"):
+ assert file_download_onetime(recid,record,None)=="downloaded"
+ with app.test_request_context('?token=MSB1c2VyQGV4YW1wbGUub3JnIDIwMjItMDktMjcgNDBDRkNGODFGM0FFRUI0Ng==&mailaddress='+ mailaddress):
+ with patch("flask_login.utils._get_user", return_value=users[0]["obj"]):
+ with patch("flask.templating._render", return_value=""):
+ with patch("weko_records_ui.fd.get_onetime_download", return_value=db_fileonetimedownload):
+ with patch("weko_records_ui.fd.record_file_factory", return_value=file_object):
+ with patch('weko_records_ui.fd.check_and_send_usage_report',return_value ="error"):
+ with patch("weko_records_ui.fd.redirect", return_value=""):
+ assert file_download_onetime(recid,record)==""
+ with app.test_request_context():
+ with patch("flask_login.utils._get_user", return_value=users[0]["obj"]):
+ with patch("flask.templating._render", return_value=""):
+ with patch("weko_records_ui.fd.get_onetime_download", return_value=db_fileonetimedownload):
+ with patch("weko_records_ui.fd.record_file_factory", return_value=file_object):
+ with patch('weko_records_ui.fd.check_and_send_usage_report',return_value ="error"):
+ with patch("weko_records_ui.fd.redirect", return_value=""):
+ assert file_download_onetime(recid,record)==""
+ with patch('weko_records_ui.fd.check_and_send_usage_report',return_value =""):
+ with patch('weko_records_ui.fd.update_onetime_download',return_value =True):
+ with patch('weko_records_ui.fd._download_file',return_value ="downloaded"):
+ # call by method
+ file_name = "/helloworld_open_restricted.pdf"
+ assert file_download_onetime(recid,record,file_name, user_mail, True)=="downloaded"
+
+ adminsetting = AdminSettings(id=5,name='restricted_access',settings={"password_enable": True})
+ #with app.test_request_context('?token=MSB1c2VyQGV4YW1wbGUub3JnIDIwMjItMDktMjcgNDBDRkNGODFGM0FFRUI0Ng==&mailaddress='+ mailaddress + '&isajax=true'):
+ with app.test_client() as client:
+ with patch('weko_records_ui.fd.AdminSettings.get', return_value=adminsetting):
+ with patch("flask.templating._render", return_value=""):
+ with patch("weko_records_ui.fd.get_onetime_download", return_value=db_fileonetimedownload):
+ #with patch("weko_records_ui.fd.parse_one_time_download_token", return_value=(True, [1])):
+ res = client.post('/record/1/file/onetime/helloworld.zip',
+ data={'input_password':'test_pass'},
+ content_type='application/json')
+ assert res.status_code == 200
+
+# def _is_terms_of_use_only(file_obj:dict , req :dict) -> bool:
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_fd.py::test__is_terms_of_use_only -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test__is_terms_of_use_only(app, records_restricted, users, db_file_permission):
+
+ provide:dict = { # is_terms_of_use_only
+ "provide" :
+ [
+ {
+ "role" : "none_loggin",
+ "workflow" : "2"
+ },
+ {
+ "role" : "3",
+ "workflow" : "2"
+ }
+ ]
+ }
+
+ provide_not:dict = { #is not_terms_of_use_only
+ "provide" :
+ [
+ {
+ "role" : "none_loggin",
+ "workflow" : "1"
+ },
+ {
+ "role" : "3",
+ "workflow" : "1"
+ }
+ ]
+ }
+
+ with app.test_request_context():
+ # 25
+ # "none_loggin"
+ assert _is_terms_of_use_only(provide ,{'terms_of_use_only': True})
+ assert not _is_terms_of_use_only({"provide" : [{
+ "role" : "3",
+ "workflow" : "1"
+ },]},{'terms_of_use_only': True})
+
+ #Contributer
+ with patch("flask_login.utils._get_user", return_value=users[0]["obj"]):
+ assert _is_terms_of_use_only(provide,{'terms_of_use_only': True})
+
+ # 26
+ assert not _is_terms_of_use_only(provide ,{})
+ assert not _is_terms_of_use_only({"provide" : []},{'terms_of_use_only': True})
+
+ # 27
+ # "none_loggin"
+ assert not _is_terms_of_use_only(provide_not ,{'terms_of_use_only': True})
+
+ #Contributer
+ with patch("flask_login.utils._get_user", return_value=users[0]["obj"]):
+ assert not _is_terms_of_use_only(provide_not,{'terms_of_use_only': True})
+
+# def file_download_secret(pid, record, _record_file_factory=None, **kwargs):
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_fd.py::test_file_download_secret -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_file_download_secret(app,db, itemtypes, users, records):
+ indexer, results = records
+ recid = results[1]["recid"]
+ record = results[1]["record"]
+
+ # token:str = re.sub("^.+?token=" ,"" , urls[0])
+ with app.test_request_context("?token=MSA1IDIwMjMtMDMtMDggMDA6NTI6MTkuNjI0NTUyIDZGQTdEMzIxQTk0OTU1MEQ="):
+ p = FileSecretDownload.create(file_name="helloworld.docx", record_id=recid.pid_value, user_mail=users[0]["email"] ,download_count = 1)
+ factory = MagicMock()
+ factory.obj = {"":""}
+ with patch("flask_login.utils._get_user", return_value=users[1]["obj"]):
+ with patch("weko_records_ui.fd.render_template", side_effect=lambda x,error: (x,error)): #return param
+ with patch("weko_records_ui.fd._download_file", return_value="_download_file"):
+ with patch("weko_records_ui.fd.parse_secret_download_token", return_value=( "parse_secret_download_token",("token"))):
+ #28
+ assert file_download_secret(recid,record,record_file_factory) == ('weko_theme/error.html', "parse_secret_download_token")
+ with patch("weko_records_ui.fd.parse_secret_download_token", return_value=(False , (results[1]["recid"].pid_value,1,p.created,""))):
+ with patch("weko_records_ui.fd.validate_download_record", return_value=None):
+ with patch("weko_records_ui.fd.validate_secret_download_token", return_value=(False , "validate_secret_download_token")):
+ # 29
+ assert file_download_secret(recid,record,record_file_factory,filename="helloworld.docx")==('weko_theme/error.html' , "validate_secret_download_token")
+ with patch("weko_records_ui.fd.validate_secret_download_token", return_value=(True , "")):
+ with patch("weko_records_ui.fd.record_file_factory", return_value=""):
+ # 30
+ assert file_download_secret(recid,record,record_file_factory=lambda x ,y ,z: "",filename="helloworld.docx")==('weko_theme/error.html' , "{} does not exist.".format(results[1]["filename"]))
+ with patch("weko_records_ui.fd.record_file_factory", return_value=factory):
+ with patch("weko_records_ui.fd.get_secret_download", return_value=p):
+ with patch("weko_records_ui.fd.update_secret_download", return_value=None):
+ assert file_download_secret(results[0]["recid"],results[0]["record"],record_file_factory=None,filename="helloworld.docx")==('weko_theme/error.html' , "Unexpected error occurred.")
+ #31
+ assert file_download_secret(recid,record,record_file_factory,filename="helloworld.docx")=="_download_file"
+ assert db.session.query(FileSecretDownload).one_or_none().download_count == 0
+ with patch("weko_records_ui.fd.get_secret_download", return_value=None):
+ with pytest.raises(Forbidden):
+ file_download_secret(recid,record,record_file_factory,filename="helloworld.docx")
+ with patch("weko_records_ui.fd.render_template", side_effect=lambda x,error: (x,error)): #return param
+ with patch("weko_records_ui.fd.parse_secret_download_token", return_value=(False , (results[1]["recid"].pid_value,1,p.created,""))):
+ with patch("weko_records_ui.fd.validate_secret_download_token", return_value=(True , "")):
+ with patch("weko_records_ui.fd._download_file", return_value="_download_file"):
+ with patch("weko_records_ui.fd.record_file_factory", return_value=factory):
+ with patch("weko_records_ui.fd.get_secret_download", return_value=p):
+ assert file_download_secret(recid,record,record_file_factory,filename="helloworld.docx")=="_download_file"
- with patch("weko_records_ui.fd.record_file_factory", return_value=False):
- assert file_download_onetime(recid,record,record_file_factory)==""
diff --git a/modules/weko-records-ui/tests/test_models.py b/modules/weko-records-ui/tests/test_models.py
new file mode 100644
index 0000000000..f917dcb09c
--- /dev/null
+++ b/modules/weko-records-ui/tests/test_models.py
@@ -0,0 +1,171 @@
+import io
+from datetime import datetime, timedelta, timezone
+from unittest import mock # python3
+from unittest.mock import MagicMock
+
+import mock # python2, after pip install mock
+import pytest
+from flask import Flask, json, jsonify, session, url_for
+from flask_babelex import get_locale, to_user_timezone, to_utc
+from flask_login import current_user
+from flask_security import login_user
+from flask_security.utils import login_user
+from invenio_accounts.models import Role, User
+from invenio_accounts.testutils import create_test_user, login_user_via_session
+from mock import patch
+
+from weko_records_ui.models import (
+ FileSecretDownload
+ ,FilePermission
+ ,FileOnetimeDownload
+)
+
+# def find_list_permission_approved(record_id, file_name):
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_models.py::test_find_list_permission_approved -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_find_list_permission_approved(app, records_restricted, users,db_file_permission):
+ #32
+ indexer, results = records_restricted
+ recid = results[len(results)-1]["recid"]
+ filename =results[len(results)-1]["filename"]
+ assert len(FilePermission.find_list_permission_approved(users[0]["id"],recid.pid_value, filename)) == 2
+
+# def find_by_activity:
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_models.py::test_find_by_activity -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_find_by_activity(db_file_permission):
+ #34
+ listpermission:list = FilePermission.find_by_activity("usage_application_activity_id_dummy1")
+
+ sorted_list = sorted(listpermission, key= lambda x: x.id ,reverse=True)
+ assert listpermission == sorted_list
+
+# def find_downloadable_only(cls, **obj) -> list:
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_models.py::test_find_downloadable_only -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+@pytest.mark.skip(reason="'from sqlalchemy.dialects.postgresql import INTERVAL' can't tests on SQLite.")
+def test_find_downloadable_only(app,db):
+ # 35
+ user_mail ='aaa@example.org'
+ record_id=1
+ file_name="text.txt"
+ created=datetime.now() - timedelta(2)
+ with app.test_request_context():
+ # with db.session.begin_nested():
+ FileOnetimeDownload.create(**{"user_mail":user_mail,"record_id":record_id,"file_name":file_name,"download_count":0 ,"expiration_date":2})
+ FileOnetimeDownload.create(**{"user_mail":user_mail,"record_id":record_id,"file_name":file_name,"download_count":1 ,"expiration_date":1})
+ FileOnetimeDownload.create(**{"user_mail":user_mail,"record_id":record_id,"file_name":file_name,"download_count":1 ,"expiration_date":2})
+ FileOnetimeDownload.create(**{"user_mail":user_mail,"record_id":record_id,"file_name":file_name,"download_count":1 ,"expiration_date":2})
+
+ recs = FileOnetimeDownload.find_downloadable_only(user_mail=user_mail,record_id=record_id,file_name=file_name)
+ assert len(recs) == 2
+
+
+# def find_by_activity:
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_models.py::test_find_by_activity -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_init():
+ # 36
+ dl = FileSecretDownload("a","b","c",1,2)
+ assert dl.file_name == "a"
+ assert dl.user_mail == "b"
+ assert dl.record_id == "c"
+ assert dl.download_count == 1
+ assert dl.expiration_date == 2
+
+# def create(cls, **data):
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_models.py::test_create -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_create(app,db):
+ # 37 42
+ with app.test_request_context():
+ dl = FileSecretDownload.create(
+ file_name = "a"
+ ,user_mail ="b"
+ ,record_id = "c"
+ ,download_count = 1
+ ,expiration_date= 2
+ )
+ assert dl.id
+ assert dl.created
+ rec = FileSecretDownload.find(
+ id = dl.id
+ ,file_name = "a"
+ ,record_id = "c"
+ ,created = dl.created
+ )
+ assert len(rec) == 1
+ rec = rec[0]
+ assert rec.file_name == "a"
+ assert rec.user_mail == "b"
+ assert rec.record_id == "c"
+ assert rec.download_count == 1
+ assert rec.expiration_date == 2
+
+ # 38
+ with app.test_request_context():
+ with patch("weko_records_ui.models.db.session.add", side_effect=Exception("test_error")):
+ defaultlength = len(FileSecretDownload.query.filter_by().all())
+ with pytest.raises(Exception):
+ dl = FileSecretDownload.create(
+ file_name = "a"
+ ,user_mail ="b"
+ ,record_id = "c"
+ )
+ assert defaultlength == len(FileSecretDownload.query.filter_by().all())
+
+# def update_download(cls, **data):
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_models.py::test_update_download -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_update_download(app,db):
+ with app.test_request_context():
+ # 39
+ dl = FileSecretDownload.create(
+ file_name = "a"
+ ,user_mail ="b"
+ ,record_id = "c"
+ ,download_count = 1
+ ,expiration_date= 2
+ )
+ result = FileSecretDownload.update_download(
+ id = dl.id
+ ,file_name = "a"
+ ,record_id = "c"
+ ,created = dl.created
+ ,download_count = 100
+ )
+ if result:
+ assert result[0].download_count == 100
+ else:
+ assert False
+
+ # 40
+ assert FileSecretDownload.update_download(
+ id = dl.id + 1
+ ,file_name = "a"
+ ,record_id = "c"
+ ,created = dl.created
+ ) == None
+ assert FileSecretDownload.update_download(
+ id = dl.id
+ ,file_name = "a"
+ ,record_id = "c"
+ ,created = dl.created
+ )
+def test_update_download2(app,db):
+ with app.test_request_context():
+ # 41
+ dl = FileSecretDownload.create(
+ file_name = "a"
+ ,user_mail ="b"
+ ,record_id = "c"
+ ,download_count = 1
+ ,expiration_date= 2
+ )
+ with patch("weko_records_ui.models.db.session.merge", side_effect=Exception("test_error")):
+ before = FileSecretDownload.query.filter_by().one_or_none().download_count
+ try:
+ dl = FileSecretDownload.update_download(
+ id = dl.id
+ ,file_name = "a"
+ ,record_id = "c"
+ ,created = dl.created
+ ,download_count = 200
+ )
+ assert False
+ except:
+ assert before == FileSecretDownload.query.filter_by().one_or_none().download_count
\ No newline at end of file
diff --git a/modules/weko-records-ui/tests/test_permissions.py b/modules/weko-records-ui/tests/test_permissions.py
index 1a81f1681f..46b78ea1c0 100644
--- a/modules/weko-records-ui/tests/test_permissions.py
+++ b/modules/weko-records-ui/tests/test_permissions.py
@@ -5,7 +5,7 @@
import mock # python2, after pip install mock
import pytest
-from flask import Flask, json, jsonify, session, url_for
+from flask import Flask, json, jsonify, session, url_for, current_app
from flask_babelex import get_locale, to_user_timezone, to_utc
from flask_login import current_user
from flask_security import login_user
@@ -13,6 +13,8 @@
from invenio_accounts.models import Role, User
from invenio_accounts.testutils import create_test_user, login_user_via_session
from mock import patch
+from weko_records_ui.config import WEKO_PERMISSION_SUPER_ROLE_USER
+from weko_records_ui.models import FileOnetimeDownload
from weko_records_ui.permissions import (
check_created_id,
@@ -29,7 +31,9 @@
check_original_pdf_download_permission,
file_permission_factory,
page_permission_factory,
- is_open_restricted
+ is_open_restricted,
+ is_owners_or_superusers,
+ __isint
)
@@ -64,13 +68,23 @@ def test_file_permission_factory(app, records, users,db_file_permission):
# def get_email_list_by_ids(user_id_list):
# def __check_user_permission(user_id_list):
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_permissions.py::test_check_file_download_permission -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
-def test_check_file_download_permission(app, records, users,db_file_permission):
+def test_check_file_download_permission(app, records, users):#, db_file_permission
+ current_app.extensions['invenio-search'] = MagicMock()
+ print("invenio-search current_app")
+ print(vars(current_app.extensions['invenio-search']['app']))
+ print("invenio-search app")
+ print(vars(app.extensions['invenio-search']['app']))
+
indexer, results = records
record = results[0]["record"]
- fjson = {'url': {'url': 'https://weko3.example.org/record/11/files/001.jpg'}, 'date': [{'dateType': 'Available', 'dateValue': '2022-09-27'}], 'format': 'image/jpeg', 'filename': 'helloworld.pdf', 'filesize': [{'value': '2.7 MB'}], 'accessrole': 'open_access', 'version_id': 'd73bd9cb-aa9e-4cd0-bf07-c5976d40bdde', 'displaytype': 'preview', 'is_thumbnail': False, 'future_date_message': '', 'download_preview_message': '', 'size': 2700000.0, 'mimetype': 'image/jpeg', 'file_order': 0}
+ fjson = {'url': {'url': 'https://weko3.example.org/record/11/files/001.jpg'}, 'date': [{'dateType': 'Available', 'dateValue': '2022-09-27'}],
+ 'format': 'image/jpeg', 'filename': 'helloworld.pdf', 'filesize': [{'value': '2.7 MB'}], 'accessrole': 'open_access',
+ 'version_id': 'd73bd9cb-aa9e-4cd0-bf07-c5976d40bdde', 'displaytype': 'preview', 'is_thumbnail': False,
+ 'future_date_message': '', 'download_preview_message': '', 'size': 2700000.0, 'mimetype': 'image/jpeg', 'file_order': 0}
+
with patch("flask_login.utils._get_user", return_value=users[1]["obj"]):
assert check_file_download_permission(record, fjson, True) == True
-
+
with patch("flask_login.utils._get_user", return_value=users[7]["obj"]):
assert check_file_download_permission(record, fjson, True) == True
@@ -78,20 +92,39 @@ def test_check_file_download_permission(app, records, users,db_file_permission):
assert check_file_download_permission(record, fjson, True) == True
with patch("flask_login.utils._get_user", return_value=users[0]["obj"]):
- with patch("weko_records_ui.permissions.to_utc", return_value=datetime.now()):
- assert check_file_download_permission(record, fjson, False) == False
+ with patch("weko_records_ui.permissions.to_utc", return_value=datetime.utcnow()):
- fjson['date'][0]['dateValue'] = ""
assert check_file_download_permission(record, fjson, False) == True
-
- fjson['date'][0]['dateValue'] = "2022-09-27"
fjson['accessrole'] = 'open_date'
assert check_file_download_permission(record, fjson, True) == True
- assert check_file_download_permission(record, fjson, False) == False
+
+ yesterday = datetime.utcnow() - timedelta(days = 1)
+ with patch("weko_records_ui.permissions.to_utc", return_value=yesterday):
+ assert check_file_download_permission(record, fjson, False) == True
+
+ tomorrow = datetime.utcnow() + timedelta(days = 1)
+ with patch("weko_records_ui.permissions.to_utc", return_value=tomorrow):
+ assert check_file_download_permission(record, fjson, False) == False
- with patch("weko_records_ui.permissions.to_utc", return_value="test"):
+ tomorrow = datetime.utcnow() + timedelta(days = 1)
+ with patch("weko_records_ui.permissions.to_utc", return_value=tomorrow):
+ fjson['accessrole'] = 'open_date'
+ fjson['roles'] = [{'role':'none_loggin'},{'role':'1'},{'role':'2'},{'role':'3'},{'role':'4'},{'role':'5'}]
assert check_file_download_permission(record, fjson, False) == False
-
+
+ fjson['date'][0]['dateValue'] = ""
+ assert check_file_download_permission(record, fjson, False) == True
+
+ fjson['accessrole'] = 'open_date'
+ record['publish_date'] = "2022-01-01"
+ fjson['roles'] = [{'role':'none_loggin'},{'role':'1'},{'role':'2'},{'role':'3'},{'role':'4'},{'role':'5'}]
+ assert check_file_download_permission(record, fjson, False) == True
+
+ fjson['date'][0]['dateValue'] = "2022-01-01"
+ record['publish_date'] = "2023-01-01"
+ fjson['role'] = [{'role':'none_loggin'},{'role':'1'},{'role':'2'},{'role':'3'},{'role':'4'},{'role':'5'}]
+ assert check_file_download_permission(record, fjson, False) == True
+
fjson['accessrole'] = 'open_login'
assert check_file_download_permission(record, fjson, True) == True
@@ -109,7 +142,64 @@ def test_check_file_download_permission(app, records, users,db_file_permission):
fjson['accessrole'] = 'open_restricted'
assert check_file_download_permission(record, fjson, True) == False
-
+
+ record = results[2]["record"]
+ fjson = {'url': {'url': 'https://weko3.example.org/record/11/files/001.jpg'},
+ 'date': [{'dateType': 'Available', 'dateValue': '2022-09-27'}], 'format': 'image/jpeg',
+ 'filename': 'helloworld.pdf', 'filesize': [{'value': '2.7 MB'}], 'accessrole': 'open_no',
+ 'version_id': 'd73bd9cb-aa9e-4cd0-bf07-c5976d40bdde', 'displaytype': 'preview',
+ 'is_thumbnail': False, 'future_date_message': '', 'download_preview_message': '', 'size': 2700000.0,
+ 'mimetype': 'image/jpeg', 'file_order': 0}
+
+ # # 'accessrole=open_no',
+ with patch("flask_login.utils._get_user", return_value=users[0]["obj"]):
+ with patch("flask_security.current_user", return_value=users[0]["obj"]):
+ with patch("flask_security.current_user.is_authenticated", return_value=True):
+ assert check_file_download_permission(record, fjson, True) == True
+
+ with patch("flask_login.utils._get_user", return_value=users[0]["obj"]):
+ assert check_file_download_permission(record, fjson, True) == True
+
+ # user一覧
+ """
+ [{'email': 'contributor@test.org', 'id': 2, 'obj': },
+ {'email': 'repoadmin@test.org', 'id': 4, 'obj': },
+ {'email': 'sysadmin@test.org', 'id': 5, 'obj': },
+ {'email': 'comadmin@test.org', 'id': 3, 'obj': },
+ {'email': 'generaluser@test.org', 'id': 6, 'obj': },
+ {'email': 'originalroleuser@test.org', 'id': 7, 'obj': },
+ {'email': 'originalroleuser2@test.org', 'id': 8, 'obj': },
+ {'email': 'user@test.org', 'id': 1, 'obj': }]
+ """
+
+ with patch("flask_login.utils._get_user", return_value=users[7]["obj"]):
+ assert check_file_download_permission(record, fjson, False) == True
+
+ # generaluser
+ record = results[0]["record"]
+ with patch("flask_login.utils._get_user", return_value=users[4]["obj"]):
+ assert check_file_download_permission(record, fjson, False) == False
+
+ fjson = {'url': {'url': 'https://weko3.example.org/record/11/files/001.jpg'}, 'date': [{'dateType': 'Available', 'dateValue': '2023-04-01'}], 'format': 'image/jpeg', 'filename': 'helloworld.pdf', 'filesize': [{'value': '2.7 MB'}], 'accessdate': '2050-01-01', 'accessrole': 'open_date', 'roles':[{'role':'1'},{'role':'2'}], 'version_id': 'd73bd9cb-aa9e-4cd0-bf07-c5976d40bdde', 'displaytype': 'preview', 'is_thumbnail': False, 'future_date_message': '', 'download_preview_message': '', 'size': 2700000.0, 'mimetype': 'image/jpeg', 'file_order': 0}
+ record = results[1]["record"]
+ with patch("flask_login.utils._get_user", return_value=users[4]["obj"]):
+ assert check_file_download_permission(record, fjson, False) == False
+
+ fjson = {'url': {'url': 'https://weko3.example.org/record/11/files/001.jpg'}, 'date': [{'dateType': 'Available', 'dateValue': '2023-04-01'}], 'format': 'image/jpeg', 'filename': 'helloworld.pdf', 'filesize': [{'value': '2.7 MB'}], 'accessdate': '2023-06-01', 'accessrole': 'open_date', 'roles':[{'role':'1'},{'role':'2'}], 'version_id': 'd73bd9cb-aa9e-4cd0-bf07-c5976d40bdde', 'displaytype': 'preview', 'is_thumbnail': False, 'future_date_message': '', 'download_preview_message': '', 'size': 2700000.0, 'mimetype': 'image/jpeg', 'file_order': 0}
+ record = results[1]["record"]
+ with patch("flask_login.utils._get_user", return_value=users[2]["obj"]):
+ assert check_file_download_permission(record, fjson, False) == True
+
+ with patch("flask_login.utils._get_user", return_value=users[0]["obj"]):
+ assert check_file_download_permission(record, fjson, False) == False
+
+ fjson = {'url': {'url': 'https://weko3.example.org/record/11/files/001.jpg'}, 'date': [{'dateType': 'Available', 'dateValue': '2023-04-01'}], 'format': 'image/jpeg', 'filename': 'helloworld.pdf', 'filesize': [{'value': '2.7 MB'}], 'accessdate': '2023-06-01', 'accessrole': 'open_login', 'roles':[{'role':'1'},{'role':'2'}], 'version_id': 'd73bd9cb-aa9e-4cd0-bf07-c5976d40bdde', 'displaytype': 'preview', 'is_thumbnail': False, 'future_date_message': '', 'download_preview_message': '', 'size': 2700000.0, 'mimetype': 'image/jpeg', 'file_order': 0}
+ with patch("flask_login.utils._get_user", return_value=users[2]["obj"]):
+ assert check_file_download_permission(record, fjson, False) == True
+
+ # generaluser
+ with patch("flask_login.utils._get_user", return_value=users[4]["obj"]):
+ assert check_file_download_permission(record, fjson, False) == False
# def check_open_restricted_permission(record, fjson):
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_permissions.py::test_check_open_restricted_permission -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
@@ -151,25 +241,31 @@ def test_check_content_clickable(app, records, users,db_file_permission):
data1.status = 0
with patch("flask_login.utils._get_user", return_value=users[1]["obj"]):
- assert check_content_clickable(record, fjson) == False
-
- fjson['accessrole'] = 'open_restricted'
- assert check_content_clickable(record, fjson) == True
-
- with patch("weko_records_ui.permissions.__get_file_permission", return_value=[data1]):
+ with patch("weko_records_ui.permissions.check_open_restricted_permission", return_value=False):
assert check_content_clickable(record, fjson) == False
- data1.status = 1
+ fjson['accessrole'] = 'open_restricted'
assert check_content_clickable(record, fjson) == True
+ with patch("weko_records_ui.permissions.check_open_restricted_permission", return_value=True):
+ fjson['accessrole'] = 'open_restricted'
+ assert check_content_clickable(record, fjson) == False
+
# def check_permission_period(permission):
-# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_permissions.py::test_get_permission -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
-def test_check_permission_period(app):
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_permissions.py::test_check_permission_period -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_check_permission_period(app,users):
data1 = MagicMock()
data1.status = 1
-
- assert check_permission_period(data1) == True
+ data1.file_name = "a"
+ data1.user_id = users[0]["id"]
+ data1.user_mail = users[0]["email"]
+ data1.record_id = "c"
+
+ with patch('weko_records_ui.models.FileOnetimeDownload.find_downloadable_only', return_value=[{}]):
+ assert check_permission_period(data1) == True
+ with patch('weko_records_ui.models.FileOnetimeDownload.find_downloadable_only', return_value=None):
+ assert check_permission_period(data1) == False
data1.status = 0
assert check_permission_period(data1) == False
@@ -184,7 +280,7 @@ def test_get_permission(app, records, users,db_file_permission):
data1 = MagicMock()
data1.status = 1
data1.usage_application_activity_id = 1
- data2 = {'Status': 'action_canceled'}
+ data2 = [{'Status': ''},{'Status': 'action_canceled'}]
with patch("flask_login.utils._get_user", return_value=users[1]["obj"]):
assert get_permission(record, fjson) == None
@@ -193,12 +289,15 @@ def test_get_permission(app, records, users,db_file_permission):
assert get_permission(record, fjson) != None
data1.status = 0
- with patch("weko_workflow.api.WorkActivity.get_activity_steps", return_value=[data2]):
+ with patch("weko_workflow.api.WorkActivity.get_activity_steps", return_value=data2):
assert get_permission(record, fjson) == None
with patch("weko_workflow.api.WorkActivity.get_activity_steps", return_value=""):
assert get_permission(record, fjson) != None
+ with patch("weko_records_ui.permissions.check_file_download_permission", return_value=""):
+ assert get_permission(record, fjson) == None
+
# def check_original_pdf_download_permission(record):
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_permissions.py::test_check_original_pdf_download_permission -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
@@ -237,7 +336,7 @@ def test_check_publish_status(app):
record = {
"_oai": {"id": "oai:weko3.example.org:00000001", "sets": ["1658073625012"]},
"path": ["1658073625012"],
- "owner": "1",
+ "owner": 1,
"recid": "1",
"title": ["2022-07-18"],
"pubdate": {"attribute_name": "PubDate", "attribute_value": "2022-07-18"},
@@ -245,7 +344,7 @@ def test_check_publish_status(app):
"_deposit": {
"id": "1",
"pid": {"type": "depid", "value": "1", "revision_id": 0},
- "owner": "1",
+ "owner": 1,
"owners": [1],
"status": "published",
"created_by": 1,
@@ -260,7 +359,7 @@ def test_check_publish_status(app):
"item_type_id": "15",
"publish_date": "2022-07-18",
"publish_status": "0",
- "weko_shared_id": -1,
+ "weko_shared_ids": [],
"item_1617186331708": {
"attribute_name": "Title",
"attribute_value_mlt": [
@@ -407,7 +506,7 @@ def test_check_publish_status2(app,publish_status,pubdate,expect_result):
record = {
"_oai": {"id": "oai:weko3.example.org:00000001", "sets": ["1658073625012"]},
"path": ["1658073625012"],
- "owner": "1",
+ "owner": 1,
"recid": "1",
"title": ["2022-07-18"],
"pubdate": {"attribute_name": "PubDate", "attribute_value": "2022-07-18"},
@@ -415,7 +514,7 @@ def test_check_publish_status2(app,publish_status,pubdate,expect_result):
"_deposit": {
"id": "1",
"pid": {"type": "depid", "value": "1", "revision_id": 0},
- "owner": "1",
+ "owner": 1,
"owners": [1],
"status": "published",
"created_by": 1,
@@ -430,7 +529,7 @@ def test_check_publish_status2(app,publish_status,pubdate,expect_result):
"item_type_id": "15",
"publish_date": "2022-07-18",
"publish_status": "0",
- "weko_shared_id": -1,
+ "weko_shared_ids": [],
"item_1617186331708": {
"attribute_name": "Title",
"attribute_value_mlt": [
@@ -526,6 +625,7 @@ def test_check_publish_status2(app,publish_status,pubdate,expect_result):
# def check_created_id(record):
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_permissions.py::test_check_created_id -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
def test_check_created_id(app, users):
datastore = app.extensions["invenio-accounts"].datastore
login_manager = app.login_manager
@@ -544,7 +644,7 @@ def login(username):
record = {
"_oai": {"id": "oai:weko3.example.org:00000001", "sets": ["1657555088462"]},
"path": ["1657555088462"],
- "owner": "1",
+ "owner": 1,
"recid": "1",
"title": ["a"],
"pubdate": {"attribute_name": "PubDate", "attribute_value": "2022-07-12"},
@@ -552,7 +652,7 @@ def login(username):
"_deposit": {
"id": "1",
"pid": {"type": "depid", "value": "1", "revision_id": 0},
- "owner": "1",
+ "owner": 1,
"owners": [1],
"status": "published",
"created_by": 1,
@@ -567,7 +667,7 @@ def login(username):
"item_type_id": "15",
"publish_date": "2022-07-12",
"publish_status": "0",
- "weko_shared_id": -1,
+ "weko_shared_ids": [],
"item_1617186331708": {
"attribute_name": "Title",
"attribute_value_mlt": [
@@ -587,7 +687,7 @@ def login(username):
}
assert record.get("_deposit", {}).get("created_by") == 1
assert record.get("item_type_id") == "15"
- assert record.get("weko_shared_id") == -1
+ assert record.get("weko_shared_ids") == []
supers = app.config["WEKO_PERMISSION_SUPER_ROLE_USER"]
user_roles = app.config["WEKO_PERMISSION_ROLE_USER"]
@@ -598,13 +698,13 @@ def login(username):
assert current_user.is_authenticated == False
assert record.get("_deposit", {}).get("created_by") == 1
assert record.get("item_type_id") == "15"
- assert record.get("weko_shared_id") == -1
+ assert record.get("weko_shared_ids") == []
assert check_created_id(record) == False
## no item type
record["item_type_id"] = ""
assert record.get("_deposit", {}).get("created_by") == 1
assert record.get("item_type_id") == ""
- assert record.get("weko_shared_id") == -1
+ assert record.get("weko_shared_ids") == []
assert check_created_id(record) == False
record["item_type_id"] = "15"
@@ -616,41 +716,41 @@ def login(username):
with app.test_request_context(headers=[("Accept-Language", "en")]):
with app.test_client() as client:
for user in users:
- # obj = user.get("obj")
- obj = MagicMock()
-
- client.get("/foo_login/{}".format(obj.email), follow_redirects=True)
+ client.get("/foo_login/{}".format(user["email"]), follow_redirects=True)
assert current_user.is_authenticated == True
- assert current_user.id == obj.id
- assert current_user.roles == obj.roles
+ assert current_user.id == user["obj"].id
+ assert set(current_user.roles) == set(user["obj"].roles)
+
super_flg = False
for s in supers:
- if s in obj.roles:
+ if s in user["obj"].roles:
super_flg = True
- print("email:{}".format(obj.email))
- print("id:{}".format(obj.id))
- print("roles:{}".format(obj.roles))
+ print("email:{}".format(user["obj"].email))
+ print("id:{}".format(user["obj"].id))
+ print("roles:{}".format(user["obj"].roles))
print("super_flg:{}".format(super_flg))
-
+
# no item_type_id
record["item_type_id"] = ""
assert record.get("item_type_id") == ""
- record["_deposit"]["created_by"] = obj.id
- record["weko_shared_id"] = -1
- assert record.get("_deposit", {}).get("created_by") == obj.id
- assert record.get("weko_shared_id") == -1
+ record["_deposit"]["created_by"] = user["obj"].id
+ record["weko_shared_ids"] = []
+ assert record.get("_deposit", {}).get("created_by") == user["obj"].id
+ assert record.get("weko_shared_ids") == []
assert check_created_id(record) == True
-
+
record["_deposit"]["created_by"] = -1
- record["weko_shared_id"] = obj.id
+ record["weko_shared_ids"] = [user["obj"].id]
assert record.get("_deposit", {}).get("created_by") == -1
- assert record.get("weko_shared_id") == obj.id
+ assert record.get("weko_shared_ids") == [user["obj"].id]
assert check_created_id(record) == True
-
+
record["_deposit"]["created_by"] = -1
- record["weko_shared_id"] = -1
+ record["weko_shared_ids"] = []
+ record["weko_shared_ids"] = []
assert record.get("_deposit", {}).get("created_by") == -1
- assert record.get("weko_shared_id") == -1
+ assert record.get("weko_shared_ids") == []
+ assert record.get("weko_shared_ids") == []
if super_flg:
assert check_created_id(record) == True
else:
@@ -660,36 +760,91 @@ def login(username):
assert record.get("item_type_id") == "15"
# created_by
- record["_deposit"]["created_by"] = obj.id
- record["weko_shared_id"] = -1
- assert record.get("_deposit", {}).get("created_by") == obj.id
- assert record.get("weko_shared_id") == -1
+ record["_deposit"]["created_by"] = user["obj"].id
+ record["weko_shared_ids"] = []
+ assert record.get("_deposit", {}).get("created_by") == user["obj"].id
+ assert record.get("weko_shared_ids") == []
assert check_created_id(record) == True
-
- # weko_shared_id
- record["_deposit"]["created_by"] = -1
- record["weko_shared_id"] = obj.id
- assert record.get("_deposit", {}).get("created_by") == -1
- assert record.get("weko_shared_id") == obj.id
+
+ # weko_shared_ids
+ record["_deposit"]["created_by"] = 1
+ record["weko_shared_ids"] = [user["obj"].id]
+ assert record.get("_deposit", {}).get("created_by") == 1
+ assert record.get("weko_shared_ids") == [user["obj"].id]
assert check_created_id(record) == True
- # created_id and weko_shared_id
- record["_deposit"]["created_by"] = obj.id
- record["weko_shared_id"] = obj.id
- assert record.get("_deposit", {}).get("created_by") == obj.id
- assert record.get("weko_shared_id") == obj.id
+ # created_id and weko_shared_ids
+ record["_deposit"]["created_by"] = user["obj"].id
+ record["weko_shared_ids"] = [user["obj"].id]
+ assert record.get("_deposit", {}).get("created_by") == user["obj"].id
+ assert record.get("weko_shared_ids") == [user["obj"].id]
assert check_created_id(record) == True
- # no created_id and weko_shared_id
- record["_deposit"]["created_by"] = -1
- record["weko_shared_id"] = -1
- assert record.get("_deposit", {}).get("created_by") == -1
- assert record.get("weko_shared_id") == -1
+ # no created_id and weko_shared_ids
+ record["_deposit"]["created_by"] = 10
+ record["weko_shared_ids"] = []
+ assert record.get("_deposit", {}).get("created_by") == 10
+ assert record.get("weko_shared_ids") == []
if super_flg:
assert check_created_id(record) == True
else:
assert check_created_id(record) == False
+ record = {
+ "_oai": {"id": "oai:weko3.example.org:00000001", "sets": ["1657555088462"]},
+ "path": ["1657555088462"],
+ "owner": 1,
+ "recid": "1",
+ "title": ["a"],
+ "pubdate": {"attribute_name": "PubDate", "attribute_value": "2022-07-12"},
+ "_buckets": {"deposit": "35004d51-8938-4e77-87d7-0c9e176b8e7b"},
+ "_deposit": {
+ "id": "1",
+ "pid": {"type": "depid", "value": "1", "revision_id": 0},
+ "owner": 1,
+ "owners": [1],
+ "status": "published",
+ "created_by": 1,
+ "owners_ext": {
+ "email": "wekosoftware@nii.ac.jp",
+ "username": "",
+ "displayname": "",
+ },
+ },
+ "item_title": "a",
+ "author_link": [],
+ "item_type_id": "15",
+ "publish_date": "2022-07-12",
+ "publish_status": "0",
+ "weko_shared_ids": [1,2,3],
+ "item_1617186331708": {
+ "attribute_name": "Title",
+ "attribute_value_mlt": [
+ {"subitem_1551255647225": "a", "subitem_1551255648112": "ja"}
+ ],
+ },
+ "item_1617258105262": {
+ "attribute_name": "Resource Type",
+ "attribute_value_mlt": [
+ {
+ "resourceuri": "http://purl.org/coar/resource_type/c_5794",
+ "resourcetype": "conference paper",
+ }
+ ],
+ },
+ "relation_version_is_last": True,
+ }
+
+ #login("contributor@test.org")
+ with app.test_request_context(headers=[("Accept-Language", "en")]):
+ with app.test_client() as client:
+ client.get("/foo_login/{}".format("contributor@test.org"), follow_redirects=True)
+ # contributor user
+ assert current_user.is_authenticated == True
+ assert record.get("_deposit", {}).get("created_by") == 1
+ assert record.get("item_type_id") == "15"
+ assert record.get("weko_shared_ids") == [1,2,3]
+ assert check_created_id(record) == True
# def check_usage_report_in_permission(permission):
def test_check_usage_report_in_permission(app):
@@ -723,9 +878,52 @@ def test_check_create_usage_report(app, records, users,db_file_permission):
# def __get_file_permission(record_id, file_name):
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_permissions.py::test___get_file_permission -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
-def test___get_file_permission(app, records, users,db_file_permission):
+def test___get_file_permission(app, records_restricted, users,db_file_permission):
+ indexer, results = records_restricted
+ recid = results[len(results)-1]["recid"]
+ filename =results[len(results)-1]["filename"]
+ with patch("flask_login.utils._get_user", return_value=users[0]["obj"]):
+ assert len(__get_file_permission(recid.pid_value, filename)) == 2
+
+# def is_owners_or_superusers(record) -> bool:
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_permissions.py::test_is_owners_or_superusers -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_is_owners_or_superusers(app,records,users):
indexer, results = records
- recid = results[0]["recid"]
- filename =results[0]["filename"]
- with patch("flask_login.utils._get_user", return_value=users[1]["obj"]):
- assert __get_file_permission(recid.pid_value, filename) == []
\ No newline at end of file
+ testrec = results[0]["record"]
+ userId = users[0]["id"] # contributer
+ with app.test_request_context():
+ # contributer
+ with patch("flask_login.utils._get_user", return_value=users[0]["obj"]):
+ assert not is_owners_or_superusers(testrec)
+
+ testrec['owner'] = userId
+ assert is_owners_or_superusers(testrec)
+
+ testrec['owner'] = -1
+ testrec['weko_shared_ids'] = [userId]
+ assert is_owners_or_superusers(testrec)
+
+ testrec['owner'] = -1
+ testrec['weko_shared_ids'] = None
+ assert not is_owners_or_superusers(testrec)
+
+ testrec['weko_shared_ids'] = []
+ # repoadmin
+ with patch("flask_login.utils._get_user", return_value=users[1]["obj"]):
+ assert is_owners_or_superusers(testrec)
+ # sysadmin
+ with patch("flask_login.utils._get_user", return_value=users[2]["obj"]):
+ assert is_owners_or_superusers(testrec)
+ # comadmin
+ with patch("flask_login.utils._get_user", return_value=users[3]["obj"]):
+ assert is_owners_or_superusers(testrec)
+
+# def __isint(str): -> bool:
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_permissions.py::test___isint -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test___isint():
+
+ assert __isint('a') == False
+ assert __isint('abc') == False
+ assert __isint('a1c') == False
+
+ assert __isint('123') == True
diff --git a/modules/weko-records-ui/tests/test_rest.py b/modules/weko-records-ui/tests/test_rest.py
index a7ea7f6858..989160427f 100644
--- a/modules/weko-records-ui/tests/test_rest.py
+++ b/modules/weko-records-ui/tests/test_rest.py
@@ -1,4 +1,823 @@
-# def create_error_handlers(blueprint):
-# def create_blueprint(endpoints):
-# def __init__(self, serializers, ctx, *args, **kwargs):
-# def get(self, pid_value, **kwargs):
+# -*- coding: utf-8 -*-
+#
+# This file is part of WEKO3.
+# Copyright (C) 2017 National Institute of Informatics.
+#
+# WEKO3 is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# WEKO3 is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with WEKO3; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307, USA.
+
+"""Module tests."""
+
+import copy
+from unittest.mock import MagicMock
+from pytest import fail
+from flask import json, url_for
+from mock import patch
+from redis import RedisError
+from sqlalchemy.exc import SQLAlchemyError
+from werkzeug.http import generate_etag
+from weko_redis.redis import RedisConnection
+
+def url(root, kwargs = {}):
+ args = ["{key}={value}".format(key = key, value = value) for key, value in kwargs.items()]
+ url = "{root}?{param}".format(root = root, param = "&".join(args)) if kwargs else root
+ return url
+
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_rest.py::test_NeedRestrictedAccess_get_v1 -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_NeedRestrictedAccess_get_v1(app, client, db, make_record_need_restricted_access, oauth_headers, users):
+ """Test NeedRestrictedAccess.get_v1 method."""
+
+ version = 'v1'
+ invalid_version = 'v0'
+ headers_sysadmin = oauth_headers[0] # OAuth token : sysadmin
+ headers_contributor = oauth_headers[1] # OAuth token : contributor
+ headers_user = oauth_headers[2] # OAuth token : user
+ headers_not_login = oauth_headers[3] # No OAuth token : not login
+
+ # Invalid version : 400 error
+ pid_value = 11
+ res = client.get(
+ f'/{invalid_version}/records/{pid_value}/need-restricted-access',
+ headers=headers_sysadmin,
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 400
+
+ # Invalid pid_value : 404 error
+ pid_value = 100
+ res = client.get(
+ f'/{version}/records/{pid_value}/need-restricted-access',
+ headers=headers_sysadmin,
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 404
+
+ # Activity is not completed : 404 error
+ pid_value = 16
+ res = client.get(
+ f'/{version}/records/{pid_value}/need-restricted-access',
+ headers=headers_sysadmin,
+ )
+ assert res.status_code == 404
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+
+ # File access is not restricted access : result is False
+ pid_value = 11
+ res = client.get(
+ f'/{version}/records/{pid_value}/need-restricted-access',
+ headers=headers_user,
+ )
+ res_data = json.loads(res.get_data())
+ assert res.status_code == 200
+ assert res_data[0]['need_restricted_access'] == False
+
+ # Login user is administrator : result is False
+ pid_value = 12
+ res = client.get(
+ f'/{version}/records/{pid_value}/need-restricted-access',
+ headers=headers_sysadmin,
+ )
+ res_data = json.loads(res.get_data())
+ assert res.status_code == 200
+ assert res_data[0]['need_restricted_access'] == False
+
+ # Login user is register user : result is False
+ pid_value = 12
+ res = client.get(
+ f'/{version}/records/{pid_value}/need-restricted-access',
+ headers=headers_contributor,
+ )
+ res_data = json.loads(res.get_data())
+ assert res.status_code == 200
+ assert res_data[0]['need_restricted_access'] == False
+
+ # Restricted access is approval : result is False
+ pid_value = 13
+ onetime_download = make_record_need_restricted_access['FileOnetimeDownload']['13']
+ # find_downloadable_only function can not execute on test.
+ with patch('weko_records_ui.models.FileOnetimeDownload.find_downloadable_only', return_value=[onetime_download]):
+ res = client.get(
+ f'/{version}/records/{pid_value}/need-restricted-access',
+ headers=headers_contributor,
+ )
+ res_data = json.loads(res.get_data())
+ assert res.status_code == 200
+ assert res_data[0]['need_restricted_access'] == False
+
+ # Restricted access is not approval : result is True
+ pid_value = 14
+ res = client.get(
+ f'/{version}/records/{pid_value}/need-restricted-access',
+ headers=headers_contributor,
+ )
+ res_data = json.loads(res.get_data())
+ assert res.status_code == 200
+ assert res_data[0]['need_restricted_access'] == True
+
+ # Restricted access is not applied : result is True
+ pid_value = 15
+ res = client.get(
+ f'/{version}/records/{pid_value}/need-restricted-access',
+ headers=headers_contributor,
+ )
+ res_data = json.loads(res.get_data())
+ assert res.status_code == 200
+ assert res_data[0]['need_restricted_access'] == True
+
+ # User who can't apply : result is True
+ pid_value = 15
+ res = client.get(
+ f'/{version}/records/{pid_value}/need-restricted-access',
+ headers=headers_user,
+ )
+ res_data = json.loads(res.get_data())
+ assert res.status_code == 200
+ assert res_data[0]['need_restricted_access'] == True
+
+ # Not login : result is True
+ pid_value = 15
+ res = client.get(
+ f'/{version}/records/{pid_value}/need-restricted-access',
+ headers=headers_not_login,
+ )
+ res_data = json.loads(res.get_data())
+ assert res.status_code == 200
+ assert res_data[0]['need_restricted_access'] == True
+
+
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_rest.py::test_GetFileTerms_get_v1 -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_GetFileTerms_get_v1(app, client, db, make_record_need_restricted_access, oauth_headers, users):
+ """Test GetFileTerms.get_v1 method."""
+
+ version = 'v1'
+ invalid_version = 'v0'
+ headers_sysadmin = oauth_headers[4] # OAuth token : sysadmin (activity_scope)
+ headers_contributor = oauth_headers[5] # OAuth token : contributor (activity_scope)
+ headers_user = oauth_headers[6] # OAuth token : user (activity_scope)
+ headers_not_login = oauth_headers[3] # No OAuth token : not login
+ headers_user_no_activity_scope = oauth_headers[2] # OAuth token : user (item_scope)
+
+ # Invalid version : 400 error
+ pid_value = 11
+ file_name = "dummy.txt"
+ res = client.get(
+ f'/{invalid_version}/records/{pid_value}/files/{file_name}/terms',
+ headers=headers_sysadmin,
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 400
+
+ # Invalid scope : 403 error
+ pid_value = 12
+ file_name = "dummy.txt"
+ res = client.get(
+ f'/{invalid_version}/records/{pid_value}/files/{file_name}/terms',
+ headers=headers_user_no_activity_scope
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 403
+
+ # Invalid pid_value : 404 error
+ pid_value = 100
+ file_name = "dummy.txt"
+ res = client.get(
+ f'/{version}/records/{pid_value}/files/{file_name}/terms',
+ headers=headers_sysadmin+[("Accept-Language", "aaa")],
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 404
+
+ # Record not found : 404 error
+ pid_value = 17
+ file_name = "dummy.txt"
+ res = client.get(
+ f'/{version}/records/{pid_value}/files/{file_name}/terms',
+ headers=headers_sysadmin+[("Accept-Language", "ja")],
+ )
+ res_data = json.loads(res.get_data())
+ assert res.status_code == 404
+
+ # Invalid file_name : 404 error
+ pid_value = 11
+ file_name = "invalid.txt"
+ res = client.get(
+ f'/{version}/records/{pid_value}/files/{file_name}/terms',
+ headers=headers_sysadmin,
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 404
+
+ # Success: 200
+ pid_value = 12
+ file_name = "dummy.txt"
+ terms_content = "利用規約本文"
+ etag = generate_etag(f"{file_name}_{terms_content}".encode("utf-8"))
+ res = client.get(
+ f'/{version}/records/{pid_value}/files/{file_name}/terms',
+ headers=headers_sysadmin,
+ )
+ res_data = json.loads(res.get_data())
+ assert res.status_code == 200
+ assert res_data['text'] == terms_content
+ assert res_data['Etag'] == etag
+
+ # Success (If-None-Match): 304
+ pid_value = 12
+ file_name = "dummy.txt"
+ terms_content = "利用規約本文"
+ etag = generate_etag(f"{file_name}_{terms_content}".encode("utf-8"))
+ headers_sysadmin_304 = copy.deepcopy(headers_sysadmin)
+ headers_sysadmin_304.append(('Accept-Language', 'en'))
+ headers_sysadmin_304.append(('If-None-Match', etag))
+ res = client.get(
+ f'/{version}/records/{pid_value}/files/{file_name}/terms',
+ headers=headers_sysadmin_304,
+ )
+ assert res.status_code == 304
+
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_rest.py::test_FileApplication_post_v1 -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_FileApplication_post_v1(app, client, db, workflows_restricted, make_record_need_restricted_access, oauth_headers, users):
+ """Test GetFileTerms.post_v1 method."""
+
+ version = 'v1'
+ invalid_version = 'v0'
+ headers_sysadmin = oauth_headers[4] # OAuth token : sysadmin (activity_scope)
+ headers_contributor = oauth_headers[5] # OAuth token : contributor (activity_scope)
+ headers_user = oauth_headers[6] # OAuth token : user (activity_scope)
+ headers_not_login = oauth_headers[3] # No OAuth token : not login
+ headers_user_no_activity_scope = oauth_headers[2] # OAuth token : user (item_scope)
+
+ # Invalid version : 400 error
+ pid_value = 12
+ file_name = "dummy.txt"
+ res = client.post(
+ f'/{invalid_version}/records/{pid_value}/files/{file_name}/application',
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_sysadmin
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 400
+
+ # No mailaddress (Guest) : 400 error
+ pid_value = 12
+ file_name = "dummy.txt"
+ params = {"mail": None}
+ res = client.post(
+ url(f'/{version}/records/{pid_value}/files/{file_name}/application', params),
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_not_login
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 400
+
+ # Invalid mailaddress (Guest) : 400 error
+ pid_value = 12
+ file_name = "dummy.txt"
+ params = {"mail": "abc"}
+ res = client.post(
+ url(f'/{version}/records/{pid_value}/files/{file_name}/application', params),
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_not_login
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 400
+
+ # Invalid token : 400 error
+ pid_value = 12
+ file_name = "dummy.txt"
+ params = {"mail":"guest@example.org", "terms_token": "aaaaa"}
+ res = client.post(
+ url(f'/{version}/records/{pid_value}/files/{file_name}/application', params),
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_not_login+[("Accept-Language", "aaa")]
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 400
+
+ # Not set workflow to role : 403 error
+ pid_value = 12
+ file_name = "dummy.txt"
+ terms_content = "利用規約本文"
+ etag = generate_etag(f"{file_name}_{terms_content}".encode("utf-8"))
+ params = {"terms_token": etag}
+ res = client.post(
+ url(f'/{version}/records/{pid_value}/files/{file_name}/application', params),
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_user+[("Accept-Language", "ja")]
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 403
+
+ # Invalid scope : 403 error
+ pid_value = 12
+ file_name = "dummy.txt"
+ res = client.post(
+ f'/{version}/records/{pid_value}/files/{file_name}/application',
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_user_no_activity_scope
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 403
+
+ # Invalid workflow set to role : 404 error
+ pid_value = 12
+ file_name = "dummy.txt"
+ terms_content = "利用規約本文"
+ etag = generate_etag(f"{file_name}_{terms_content}".encode("utf-8"))
+ params = {"terms_token": etag}
+ res = client.post(
+ url(f'/{version}/records/{pid_value}/files/{file_name}/application', params),
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_sysadmin
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 404
+
+ # pid not found : 404 error
+ pid_value = 100
+ file_name = "dummy.txt"
+ terms_content = "利用規約本文"
+ etag = generate_etag(f"{file_name}_{terms_content}".encode("utf-8"))
+ params = {"terms_token": etag}
+ res = client.post(
+ url(f'/{version}/records/{pid_value}/files/{file_name}/application', params),
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_contributor
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 404
+
+ # Record not found : 404 error
+ pid_value = 12
+ file_name = "dummy.txt"
+ terms_content = "利用規約本文"
+ etag = generate_etag(f"{file_name}_{terms_content}".encode("utf-8"))
+ params = {"terms_token": etag}
+ with patch('weko_records_ui.rest.WekoRecord.get_record', return_value=None):
+ res = client.post(
+ url(f'/{version}/records/{pid_value}/files/{file_name}/application', params),
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_contributor
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 404
+
+ # Invalid file name : 404 error
+ pid_value = 12
+ file_name = "Invalid.txt"
+ terms_content = "利用規約本文"
+ etag = generate_etag(f"{file_name}_{terms_content}".encode("utf-8"))
+ params = {"terms_token": etag}
+ res = client.post(
+ url(f'/{version}/records/{pid_value}/files/{file_name}/application', params),
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_contributor
+ )
+ try:
+ json.loads(res.get_data())
+ except:
+ assert False
+ assert res.status_code == 404
+
+ # Server error(init_activity failed): 500
+ pid_value = 12
+ file_name = "dummy.txt"
+ terms_content = "利用規約本文"
+ etag = generate_etag(f"{file_name}_{terms_content}".encode("utf-8"))
+ params = {"terms_token": etag}
+ with patch('weko_workflow.api.WorkActivity.init_activity', return_value=None):
+ res = client.post(
+ url(f'/{version}/records/{pid_value}/files/{file_name}/application', params),
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_contributor
+ )
+ assert res.status_code == 500
+
+ # Server error(SQLAlchemyError): 500
+ pid_value = 12
+ file_name = "dummy.txt"
+ terms_content = "利用規約本文"
+ etag = generate_etag(f"{file_name}_{terms_content}".encode("utf-8"))
+ params = {"terms_token": etag}
+ with patch('weko_workflow.api.WorkActivity.init_activity', side_effect=SQLAlchemyError):
+ res = client.post(
+ url(f'/{version}/records/{pid_value}/files/{file_name}/application', params),
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_contributor
+ )
+ assert res.status_code == 500
+
+ # Success: 200
+ pid_value = 12
+ file_name = "dummy.txt"
+ terms_content = "利用規約本文"
+ etag = generate_etag(f"{file_name}_{terms_content}".encode("utf-8"))
+ params = {"terms_token": etag}
+
+ activity_id = "A-00000000-00000"
+ activity = MagicMock
+ activity.activity_id = activity_id
+ itemtype_schema = {}
+ with open('tests/data/itemtype_schema_31001.json', 'r') as f:
+ itemtype_schema = json.load(f)
+
+ with patch('weko_workflow.api.WorkActivity.init_activity', return_value=activity):
+ res = client.post(
+ url(f'/{version}/records/{pid_value}/files/{file_name}/application', params),
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_contributor
+ )
+ res_data = json.loads(res.get_data())
+ assert res.status_code == 200
+ assert res_data['activity_id'] == activity_id
+ assert res_data['activity_url'] == url_for('weko_workflow.display_activity', activity_id=activity_id, _external=True, _method='GET').replace("/api", "", 1)
+ assert res_data['item_type_schema'] == itemtype_schema
+
+ # Success (Guest): 200
+ pid_value = 12
+ file_name = "dummy.txt"
+ terms_content = "利用規約本文"
+ etag = generate_etag(f"{file_name}_{terms_content}".encode("utf-8"))
+ params = {"mail":"guest@example.org", "terms_token": etag}
+
+ server_name = app.config.get('SERVER_NAME')
+ token = "QS0yMDIzMDgwMy0wMDAwMSAyMDIzLTA4LTAzIGF0c3VzaGkuc3V6dWtpQGl2aXMuY28uanAgMkEyM0RFMEY1ODI0QjU2RQ=="
+ activity_url = f"https://{server_name}/api/workflow/activity/guest-user/{file_name}?token={token}"
+ activity_id = "A-00000000-1234"
+ itemtype_schema = {}
+ with open('tests/data/itemtype_schema_31001.json', 'r') as f:
+ itemtype_schema = json.load(f)
+
+ with patch('weko_records_ui.rest.init_activity_for_guest_user', return_value=(None, activity_url)):
+ res = client.post(
+ url(f'/{version}/records/{pid_value}/files/{file_name}/application', params),
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_not_login
+ )
+ res_data = json.loads(res.get_data())
+ assert res.status_code == 200
+ assert res_data['activity_id'] == activity_id
+ assert res_data['activity_url'] == activity_url.replace("/api", "", 1)
+ assert res_data['item_type_schema'] == itemtype_schema
+
+ # Success (Guest / exists activity): 200
+ pid_value = 12
+ file_name = "dummy.txt"
+ terms_content = "利用規約本文"
+ etag = generate_etag(f"{file_name}_{terms_content}".encode("utf-8"))
+ params = {"mail":"guest@example.org", "terms_token": etag}
+
+ server_name = app.config.get('SERVER_NAME')
+ token = "QS0yMDIzMDgwMy0wMDAwMSAyMDIzLTA4LTAzIGF0c3VzaGkuc3V6dWtpQGl2aXMuY28uanAgMkEyM0RFMEY1ODI0QjU2RQ=="
+ activity_url = f"https://{server_name}/api/workflow/activity/guest-user/{file_name}?token={token}"
+ activity_id = "A-00000000-1234"
+ activity = MagicMock
+ activity.activity_id = activity_id
+ itemtype_schema = {}
+ with open('tests/data/itemtype_schema_31001.json', 'r') as f:
+ itemtype_schema = json.load(f)
+
+ with patch('weko_records_ui.rest.init_activity_for_guest_user', return_value=(activity, activity_url)):
+ res = client.post(
+ url(f'/{version}/records/{pid_value}/files/{file_name}/application', params),
+ data=json.dumps(None),
+ content_type='application/json',
+ headers=headers_not_login
+ )
+ res_data = json.loads(res.get_data())
+ assert res.status_code == 200
+ assert res_data['activity_id'] == activity_id
+ assert res_data['activity_url'] == activity_url.replace("/api", "", 1)
+ assert res_data['item_type_schema'] == itemtype_schema
+
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_rest.py::test_RequestMail_post_v1 -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_RequestMail_post_v1(app, client, db, make_request_maillist, users):
+ """Test GetFileTerms.post_v1 method."""
+
+ version = 'v1'
+ invalid_version = 'v0'
+
+ correct_request_body = {
+ "key": "test_key",
+ "from":"test1@example.com",
+ "subject":"test_subject",
+ "message":"test_message",
+ "authorization_token": 'token',
+ }
+
+ correct_pid_value = 100
+ wrong_pid_value = 1000000
+
+ # TestCase: invalid version
+ try:
+ res = client.post(
+ f'/{invalid_version}/records/{correct_pid_value}/request-mail',
+ headers = "",
+ json = correct_request_body,
+ content_type='application/json',
+ )
+ except:
+ fail()
+ assert res.status_code == 400
+
+ # TestCase: record not found
+ try:
+ res = client.post(
+ f'/{version}/records/{wrong_pid_value}/request-mail',
+ headers = "",
+ json = correct_request_body,
+ content_type='application/json',
+ )
+ except:
+ fail()
+ assert res.status_code == 404
+
+ # TestCase: 'key' not found
+ try:
+ res = client.post(
+ f'/{version}/records/{correct_pid_value}/request-mail',
+ headers = "",
+ json = {
+ "from":"test1@example.com",
+ "subject":"test_subject",
+ "message":"test_message",
+ "authorization_token": 'token',
+ },
+ content_type='application/json',
+ )
+ except:
+ fail()
+ assert res.status_code == 400
+
+ # TestCase: 'key' value is empty
+ try:
+ res = client.post(
+ f'/{version}/records/{correct_pid_value}/request-mail',
+ headers = "",
+ json = {
+ "key": '',
+ "from":"test1@example.com",
+ "subject":"test_subject",
+ "message":"test_message",
+ "authorization_token": 'token',
+ },
+ content_type='application/json',
+ )
+ except:
+ fail()
+ assert res.status_code == 400
+ # TestCase: 'from' not found
+ try:
+ res = client.post(
+ f'/{version}/records/{correct_pid_value}/request-mail',
+ headers = "",
+ json = {
+ "key": "test_key",
+ "subject":"test_subject",
+ "message":"test_message",
+ "authorization_token": 'token',
+ },
+ content_type='application/json',
+ )
+ except:
+ fail()
+ assert res.status_code == 400
+
+ # TestCase: 'from' value is empty
+ try:
+ res = client.post(
+ f'/{version}/records/{correct_pid_value}/request-mail',
+ headers = "",
+ json = {
+ "key": "test_key",
+ 'from': '',
+ "subject":"test_subject",
+ "message":"test_message",
+ "authorization_token": 'token',
+ },
+ content_type='application/json',
+ )
+ except:
+ fail()
+ assert res.status_code == 400
+
+ # TestCase: 'authorization_token' is not correct
+ try:
+ res = client.post(
+ f'/{version}/records/{correct_pid_value}/request-mail',
+ headers = "",
+ json = {
+ "key": "test_key",
+ "from":"test1@example.com",
+ "subject":"test_subject",
+ "message":"test_message",
+ "authorization_token": 'token1',
+ },
+ content_type='application/json',
+ )
+ except:
+ fail()
+ assert res.status_code == 401
+
+ # TestCase: send mail success
+ res_test = {"from":"test1@example.com","subject":"test_subject","message":"test_message"}
+ with patch("weko_records_ui.rest.send_request_mail", return_value=(True,res_test)):
+ try:
+ res = client.post(
+ f'/{version}/records/{correct_pid_value}/request-mail',
+ json = correct_request_body,
+ content_type='application/json',
+ )
+ except:
+ fail()
+ assert res.status_code == 200
+
+ # TestCase: server error
+ with patch('weko_records_ui.rest.send_request_mail', side_effect=SQLAlchemyError):
+ try:
+ res = client.post(
+ f'/{version}/records/{correct_pid_value}/request-mail',
+ headers = "",
+ json = correct_request_body,
+ content_type='application/json',
+ )
+ except:
+ fail()
+ assert res.status_code == 500
+
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_rest.py::test_CaptchaAnswerValidation_post_v1 -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_CaptchaAnswerValidation_post_v1(app, client, db):
+ version = 'v1'
+ invalid_version = 'v0'
+ res = None
+
+ correct_body = {
+ "key": "test_key",
+ "calculation_result": 100
+ }
+
+ redis_connection = RedisConnection()
+ datastore = redis_connection.connection(db=app.config['CACHE_REDIS_DB'])
+
+ datastore.hmset(b'test_key',{b'calculation_result':b'100'})
+
+ # TestCase: invalid api version
+ try:
+ res = client.post(
+ f'/{invalid_version}/captcha/validate',
+ json = correct_body,
+ content_type='application/json',
+ )
+ except:
+ fail()
+ assert res.status_code == 400
+
+ # TestCase: captcha result validation success
+ datastore.hmset(b'test_key',{b'calculation_result':b'100'})
+ try:
+ res = client.post(
+ f'/{version}/captcha/validate',
+ json = correct_body,
+ content_type='application/json',
+ )
+ except:
+ fail()
+ assert res.status_code == 200
+ assert 'authorization_token' in json.loads(res.get_data()).keys()
+
+ # TestCase: internal server error
+ with patch('weko_records_ui.rest.validate_captcha_answer', side_effect=RedisError()):
+ try:
+ res = client.post(
+ f'/{version}/captcha/validate',
+ json = correct_body,
+ content_type='application/json',
+ )
+ except:
+ fail()
+ assert res.status_code == 500
+
+ # TestCase: validate captcha if language is Japanese
+ datastore.hmset(b'test_key',{b'calculation_result':b'100'})
+ try:
+ res = client.post(
+ f'/{version}/captcha/validate',
+ headers = [("Accept-Language", "jpn")],
+ json = correct_body,
+ content_type='application/json',
+ )
+ except:
+ fail()
+ assert res.status_code == 200
+
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_rest.py::test_CreateCaptchaImage_get_v1 -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_CreateCaptchaImage_get_v1(app, client, db):
+ version = 'v1'
+ invalid_version = 'v0'
+ res = None
+
+ # TestCase: invalid api version
+ try:
+ res= client.get(f'/{invalid_version}/captcha/image')
+ except:
+ fail()
+ assert res.status_code == 400
+
+ # TestCase: create captcha image success
+ try:
+ res = client.get(f'/{version}/captcha/image')
+ except:
+ fail()
+ assert res.status_code == 200
+ assert 'key' in json.loads(res.get_data()).keys()
+ assert 'image' in json.loads(res.get_data()).keys()
+ assert 'ttl' in json.loads(res.get_data()).keys()
+
+ # TestCase: internal server error
+ with patch('weko_records_ui.rest.create_captcha_image', return_value = ("","")):
+ try:
+ res = client.get(f'/{version}/captcha/image')
+ except:
+ fail()
+ assert res.status_code == 500
+
+ # TestCase: create captcha image if language is Japanese
+ try:
+ res = client.get(f'/{version}/captcha/image', headers = [("Accept-Language", "jpn")])
+ except:
+ fail()
+ assert res.status_code == 200
diff --git a/modules/weko-records-ui/tests/test_utils.py b/modules/weko-records-ui/tests/test_utils.py
index af4b722254..16c8acbcbe 100644
--- a/modules/weko-records-ui/tests/test_utils.py
+++ b/modules/weko-records-ui/tests/test_utils.py
@@ -1,5 +1,5 @@
import pytest
-from weko_records_ui.utils import create_usage_report_for_user,get_data_usage_application_data,send_usage_report_mail_for_user,check_and_send_usage_report,check_and_create_usage_report,update_onetime_download,create_onetime_download_url,get_onetime_download,validate_onetime_download_token,get_license_pdf,hide_item_metadata,get_pair_value,get_min_price_billing_file_download,parse_one_time_download_token,generate_one_time_download_url,validate_download_record,is_private_index,get_file_info_list,replace_license_free,is_show_email_of_creator,hide_by_itemtype,hide_by_email,hide_by_file,hide_item_metadata_email_only,get_workflows,get_billing_file_download_permission,get_list_licence,restore,soft_delete,is_billing_item,get_groups_price,get_record_permalink,get_google_detaset_meta,get_google_scholar_meta,display_oaiset_path,get_terms,get_roles,check_items_settings
+from weko_records_ui.utils import create_usage_report_for_user,get_data_usage_application_data,send_usage_report_mail_for_user,check_and_send_usage_report,update_onetime_download,create_onetime_download_url,get_onetime_download,validate_onetime_download_token,get_license_pdf,hide_item_metadata,get_pair_value,get_min_price_billing_file_download,parse_one_time_download_token,generate_one_time_download_url,validate_download_record,is_private_index,get_file_info_list,replace_license_free,is_show_email_of_creator,hide_by_itemtype,hide_by_email,hide_by_file,hide_item_metadata_email_only,get_workflows,get_billing_file_download_permission,get_list_licence,restore,soft_delete,is_billing_item,get_groups_price,get_record_permalink,get_google_detaset_meta,get_google_scholar_meta,display_oaiset_path,get_terms,get_roles,check_items_settings,get_valid_onetime_download,create_secret_url,_generate_secret_download_url,parse_secret_download_token,validate_secret_download_token,get_secret_download,_create_secret_download_url,update_secret_download,get_data_by_key_array_json
import base64
from unittest.mock import MagicMock
import copy
@@ -10,16 +10,20 @@
from invenio_records_files.utils import record_file_factory
from flask import Flask, json, jsonify, session, url_for,current_app
from flask_security.utils import login_user
+from flask_babelex import to_utc
from invenio_accounts.testutils import login_user_via_session
from invenio_pidstore.models import PersistentIdentifier, PIDStatus
from mock import patch
from weko_deposit.api import WekoRecord
-from weko_records_ui.models import FileOnetimeDownload
+from weko_records_ui.models import FileOnetimeDownload, FileSecretDownload
from weko_records.api import ItemTypes,Mapping
from werkzeug.exceptions import NotFound
from weko_admin.models import AdminSettings
from weko_records.serializers.utils import get_mapping
from weko_records.models import ItemType, ItemTypeMapping, ItemTypeName
+from flask_babelex import gettext as _
+import datetime
+from datetime import datetime as dt ,timedelta
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
@@ -184,7 +188,7 @@ def test_get_list_licence(app):
def test_get_license_pdf(app):
app.config['WEKO_RECORDS_UI_LICENSE_ICON_PDF_LOCATION'] = "/static/images/creative_commons/"
lic ='license_12'
- item_metadata_json={'id': '23.1', 'pid': {'type': 'depid', 'value': '23.1', 'revision_id': 0}, 'lang': 'ja', 'owner': '1', 'title': 'test', 'owners': [1], 'status': 'published', '$schema': '/items/jsonschema/15', 'pubdate': '2022-09-28', 'created_by': 1, 'owners_ext': {'email': 'wekosoftware@nii.ac.jp', 'username': '', 'displayname': ''}, 'shared_user_id': -1, 'item_1617186331708': [{'subitem_1551255647225': 'test', 'subitem_1551255648112': 'ja'}], 'item_1617258105262': {'resourceuri': 'http://purl.org/coar/resource_type/c_ddb1', 'resourcetype': 'dataset'}, 'item_1617605131499': [{'url': {'url': 'https://weko3.example.org/record/23.1/files/sample_arial.pdf'}, 'date': [{'dateType': 'Available', 'dateValue': '2022-09-28'}], 'format': 'application/pdf', 'filename': 'sample_arial.pdf', 'filesize': [{'value': '28 KB'}], 'mimetype': 'application/pdf', 'accessrole': 'open_access', 'version_id': '72b25fac-c471-44af-9971-c608f684f863', 'displaytype': 'preview', 'licensetype': 'license_12'}]}
+ item_metadata_json={'id': '23.1', 'pid': {'type': 'depid', 'value': '23.1', 'revision_id': 0}, 'lang': 'ja', 'owner': 1, 'title': 'test', 'owners': [1], 'status': 'published', '$schema': '/items/jsonschema/15', 'pubdate': '2022-09-28', 'created_by': 1, 'owners_ext': {'email': 'wekosoftware@nii.ac.jp', 'username': '', 'displayname': ''}, 'shared_user_ids': [], 'item_1617186331708': [{'subitem_1551255647225': 'test', 'subitem_1551255648112': 'ja'}], 'item_1617258105262': {'resourceuri': 'http://purl.org/coar/resource_type/c_ddb1', 'resourcetype': 'dataset'}, 'item_1617605131499': [{'url': {'url': 'https://weko3.example.org/record/23.1/files/sample_arial.pdf'}, 'date': [{'dateType': 'Available', 'dateValue': '2022-09-28'}], 'format': 'application/pdf', 'filename': 'sample_arial.pdf', 'filesize': [{'value': '28 KB'}], 'mimetype': 'application/pdf', 'accessrole': 'open_access', 'version_id': '72b25fac-c471-44af-9971-c608f684f863', 'displaytype': 'preview', 'licensetype': 'license_12'}]}
file_item_id = 'item_1617605131499'
footer_w =90
footer_h = 4
@@ -390,19 +394,91 @@ def test_get_file_info_list(app,records):
ret = get_file_info_list(record)
assert len(ret)==2
+ # 異常系
+ # 不正な数値を指定する
+ record['item_1617605131499']['attribute_value_mlt'][0]['filesize'][0]['value'] = '1.7976931348623157e+308/0 kb'
+ with app.test_request_context(headers=[("Accept-Language", "en")]):
+ ret = get_file_info_list(record)
+ assert ret[1][0]['size'] == -1
+ record['item_1617605131499']['attribute_value_mlt'][0]['filesize'][0]['value'] = '5 kb'
-# def check_and_create_usage_report(record, file_object):
-# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py::test_check_and_create_usage_report -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
-def test_check_and_create_usage_report(app,records):
- indexer, results = records
- pid = results[0]["recid"]
- record = results[0]["record"]
- filename = results[0]["filename"]
- fileobj = record_file_factory(
- pid, record, filename
- )
- assert check_and_create_usage_report(record,fileobj)==None
+ # access == "open_login"
+ record['item_1617605131499']['attribute_value_mlt'][0]['accessrole'] = 'open_login'
+ with app.test_request_context(headers=[("Accept-Language", "en")]):
+ ret = get_file_info_list(record)
+ assert ret[1][0]['future_date_message'] == 'Restricted Access'
+ # access == "open_date"
+ record['item_1617605131499']['attribute_value_mlt'][0]['accessrole'] = 'open_date'
+ # dateValue == None
+ record['item_1617605131499']['attribute_value_mlt'][0]['date'] = [{'dateType':'Available'}]
+ with app.test_request_context(headers=[("Accept-Language", "en")]):
+ ret = get_file_info_list(record)
+ adt = str(datetime.date.max)
+ pdt = to_utc(dt.strptime(adt, '%Y-%m-%d'))
+ assert ret[1][0]['future_date_message'] == "Download is available from {}/{}/{}.".format(pdt.year, pdt.month, pdt.day)
+ assert ret[1][0]['download_preview_message'] == "Download / Preview is available from {}/{}/{}.".format(pdt.year, pdt.month, pdt.day)
+
+ # dateValue == 過去
+ past_time = dt.now() - timedelta(days=3)
+ past_time_str = str(past_time).split(' ')[0]
+ past_time_str = str(dt.strptime(past_time_str, '%Y-%m-%d')).split(' ')[0]
+ record['item_1617605131499']['attribute_value_mlt'][0]['date'][0]['dateValue'] = past_time_str
+ with app.test_request_context(headers=[("Accept-Language", "en")]):
+ ret = get_file_info_list(record)
+ pdt = to_utc(past_time)
+ assert ret[1][0]['future_date_message'] == ""
+ assert ret[1][0]['download_preview_message'] == ""
+
+ # dateValue == 未来
+ future_time = dt.now() + timedelta(days=3)
+ future_time_str = str(future_time).split(' ')[0]
+ future_time_str = str(dt.strptime(future_time_str, '%Y-%m-%d')).split(' ')[0]
+ record['item_1617605131499']['attribute_value_mlt'][0]['date'][0]['dateValue'] = future_time_str
+ with app.test_request_context(headers=[("Accept-Language", "en")]):
+ ret = get_file_info_list(record)
+ pdt = to_utc(future_time)
+ assert ret[1][0]['future_date_message'] == "Download is available from {}/{}/{}.".format(pdt.year, pdt.month, pdt.day)
+ assert ret[1][0]['download_preview_message'] == "Download / Preview is available from {}/{}/{}.".format(pdt.year, pdt.month, pdt.day)
+
+# def get_file_info_list(record):
+# def get_file_size(p_file):
+# def set_message_for_file(p_file):
+# def get_data_by_key_array_json(key, array_json, get_key):
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py::test_get_file_info_list_1 -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_get_file_info_list_1(app, make_record_need_restricted_access):
+ # roles = [{"role":1},{"role":2}]
+ record_1 = WekoRecord.get_record_by_pid(11)
+ record_1['item_1689228169922']['attribute_value_mlt'][0]['roles'] = [{"role":1},{"role":2}]
+ with app.test_request_context(headers=[("Accept-Language", "en")]):
+ is_display_file_preview, files = get_file_info_list(record_1)
+ assert is_display_file_preview == True
+ assert len(files) == 1
+
+ # 'provide': [{'role': '2', 'workflow': '3'}, {'role': 'none_loggin', 'workflow': '3'}, {'role': '1', 'workflow': '99'}, {'role': '3', 'workflow': '3'}]
+ # terms='term_free' termsDescription='利用規約本文'
+ record_2 = WekoRecord.get_record_by_pid(12)
+ with app.test_request_context(headers=[("Accept-Language", "en")]):
+ is_display_file_preview, files = get_file_info_list(record_2)
+ assert is_display_file_preview == True
+ assert len(files) == 1
+
+ record_2['item_1689228169922']['attribute_value_mlt'][0]['terms'] = '100'
+ with app.test_request_context(headers=[("Accept-Language", "en")]):
+ is_display_file_preview, files = get_file_info_list(record_2)
+ assert is_display_file_preview == True
+ assert len(files) == 1
+
+# def get_data_by_key_array_json(record):
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py::test_get_data_by_key_array_json -vv -s --cov-branch --cov-report=term --cov-report=html --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_get_data_by_key_array_json(app):
+ array_json = [{'id': 'test1', 'value':'value1'}, {'id': 'test2', 'value':'value2'}, {'hoge': 1}]
+ key = 'test2'
+ get_key = 'value'
+ assert 'value2' == get_data_by_key_array_json(key, array_json, get_key)
+ none_key = 'abc'
+ assert None == get_data_by_key_array_json(none_key, array_json, get_key)
+ assert None == get_data_by_key_array_json(key, [], get_key)
# def create_usage_report_for_user(onetime_download_extra_info: dict):
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
@@ -438,7 +514,7 @@ def test_send_usage_report_mail_for_user(app):
# def check_and_send_usage_report(extra_info, user_mail):
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py::test_check_and_send_usage_report -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
-def test_check_and_send_usage_report(app, db, workflows, records, users, db_file_permission):
+def test_check_and_send_usage_report(app, db, users, db_file_permission):
_record = {
'recid': db_file_permission[0].record_id
}
@@ -447,10 +523,10 @@ def test_check_and_send_usage_report(app, db, workflows, records, users, db_file
'filename': db_file_permission[0].file_name
}
app.config['WEKO_WORKFLOW_USAGE_REPORT_WORKFLOW_NAME'] = 'Data Usage Report'
- with patch("flask_login.utils._get_user", return_value=users[7]['obj']):
- with patch("weko_workflow.utils.create_record_metadata", return_value='usage_report_activity_0'):
- assert check_and_send_usage_report(_record, _file_obj)==None
-
+
+ #56
+ assert not check_and_send_usage_report({"is_guest": False, "send_usage_report": False, "usage_application_activity_id": "A-20230101-00001"},users[7]['email'],_record, _file_obj)
+
data1 = MagicMock()
data2 = MagicMock()
data3 = MagicMock()
@@ -461,22 +537,30 @@ def send_reminder_mail(x, y, z):
def send_reminder_mail_2(x, y, z):
return True
+ data1.activity_id = 'A-20230301-00001'
data3.send_reminder_mail = send_reminder_mail
with patch("flask_login.utils._get_user", return_value=users[2]['obj']):
- with patch("weko_records_ui.utils.create_usage_report_for_user", return_value=data1):
- with patch("weko_records_ui.utils.UsageReport", return_value=data3):
- check_and_send_usage_report(data1, data2)
with patch("weko_records_ui.utils.create_usage_report_for_user", return_value=False):
- check_and_send_usage_report(data1, data2)
+ assert _("Unexpected error occurred.") == check_and_send_usage_report({"is_guest": False, "send_usage_report": True, "usage_application_activity_id": "A-20230101-00001"},users[7]['email'],data1, data2)
with patch("weko_records_ui.utils.create_usage_report_for_user", return_value=data1):
with patch("weko_records_ui.utils.UsageReport", return_value=data3):
- data3.send_reminder_mail = send_reminder_mail_2
- check_and_send_usage_report(data1, data2)
+ assert _("Failed to send mail.") == check_and_send_usage_report({"is_guest": False, "send_usage_report": True, "usage_application_activity_id": "A-20230101-00001"},users[7]['email'],data1, data2)
-
+ with patch("weko_records_ui.utils.create_usage_report_for_user", return_value=data1):
+ data3.send_reminder_mail = send_reminder_mail_2
+ with patch("weko_records_ui.utils.UsageReport", return_value=data3):
+ with patch("weko_records_ui.utils.check_create_usage_report" ,return_value={}):
+ with patch("weko_records_ui.models.FilePermission.update_usage_report_activity_id",return_value=""):
+ check_and_send_usage_report({"is_guest": False, "send_usage_report": True, "usage_application_activity_id": "A-20230101-00001"},users[7]['email'],_record, _file_obj)
+ data1.activity_id = ""
+ with patch("weko_records_ui.utils.create_usage_report_for_user", return_value=data1):
+ with patch("flask_login.utils._get_user", return_value=users[7]['obj']):
+ with patch("weko_records_ui.utils.UsageReport", return_value=data3):
+ with patch("weko_records_ui.utils.check_create_usage_report",return_value=None):
+ check_and_send_usage_report({"is_guest": False, "send_usage_report": True, "usage_application_activity_id": "A-20230101-00001"},users[7]['email'],data1, data2)
# def generate_one_time_download_url(
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py::test_generate_one_time_download_url -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
@@ -551,12 +635,25 @@ def test_get_onetime_download(app, db_fileonetimedownload):
ret = get_onetime_download('helloworld.pdf','1','wekosoftware@nii.ac.jp')
assert ret.file_name=='helloworld.pdf'
+# def def get_valid_onetime_download(file_name: str, record_id: str,user_mail: str) -> Optional[FileOnetimeDownload]:
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py::test_get_valid_onetime_download -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_get_valid_onetime_download():
+ with patch("weko_records_ui.models.FileOnetimeDownload.find_downloadable_only",return_value=[]):
+ assert get_valid_onetime_download(file_name= "str", record_id= "str",user_mail= "str") is None
+ with patch("weko_records_ui.models.FileOnetimeDownload.find_downloadable_only",return_value=[{}]):
+ assert {} == get_valid_onetime_download(file_name= "str", record_id= "str",user_mail= "str")
+ with patch("weko_records_ui.models.FileOnetimeDownload.find_downloadable_only",return_value=["a","b"]):
+ assert "a" == get_valid_onetime_download(file_name= "str", record_id= "str",user_mail= "str")
# def create_onetime_download_url(
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py::test_create_onetime_download_url -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
def test_create_onetime_download_url(app):
with app.test_request_context():
- assert create_onetime_download_url('ACT','helloworld.pdf','1','wekosoftware@nii.ac.jp')==None
+ assert create_onetime_download_url('ACT','helloworld.pdf','1','wekosoftware@nii.ac.jp','test_password')==None
+
+ with app.test_request_context():
+ with patch('weko_records_ui.utils.get_restricted_access', return_value=""):
+ assert create_onetime_download_url('ACT','helloworld.pdf','1','wekosoftware@nii.ac.jp','test_password')==False
# def update_onetime_download(**kwargs) -> NoReturn:
@@ -625,4 +722,179 @@ def test_get_google_detaset_meta(app, records, itemtypes, oaischema, oaiidentify
data1 = MagicMock()
with patch("lxml.etree", return_value=data1):
- assert get_google_detaset_meta(record) == None
\ No newline at end of file
+ assert get_google_detaset_meta(record) == None
+
+#def create_secret_url(record_id:str ,file_name:str ,user_mail:str ,restricted_fullname='',restricted_data_name='') -> dict:
+# def _generate_secret_download_url(file_name: str, record_id: str, id: str ,created :dt) -> str:
+# _create_secret_download_url(file_name: str, record_id: str, user_mail: str)
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py::test_create_secret_url -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_create_secret_url(app,db,users,records):
+ url , results = records
+ file_name= results[1]["filename"]
+ record_id=results[1]["recid"].pid_value
+ user_mail = users[0]["email"]
+
+ db.session.add(AdminSettings(id=6,name='restricted_access',settings={"secret_URL_file_download":
+ {"secret_enable": True,
+ "secret_download_limit": 1,
+ "secret_expiration_date": 9999999,
+ "secret_download_limit_unlimited_chk": False,
+ "secret_expiration_date_unlimited_chk": False}}))
+
+ with app.test_request_context():
+
+ #60
+ #76
+ # with db.session.begin_nested():
+ return_dict = create_secret_url(file_name= file_name, record_id=record_id, user_mail=user_mail)
+
+ assert return_dict["restricted_download_count"] == '1'
+ assert return_dict["restricted_download_count_ja"] == ""
+ assert return_dict["restricted_download_count_en"] == ""
+ assert return_dict['restricted_expiration_date'] == ""
+ assert return_dict['restricted_expiration_date_ja'] == "無制限"
+ assert return_dict['restricted_expiration_date_en'] == "Unlimited"
+
+ #61
+ # with db.session.begin_nested():
+ db.session.merge(AdminSettings(id=6,name='restricted_access',settings={"secret_URL_file_download":
+ {"secret_enable": True,
+ "secret_download_limit": 9999999,
+ "secret_expiration_date": 1,
+ "secret_download_limit_unlimited_chk": False,
+ "secret_expiration_date_unlimited_chk": False}}))
+ return_dict = create_secret_url(file_name= file_name
+ , record_id=record_id
+ , user_mail=user_mail)
+ assert return_dict["restricted_download_count"] == ""
+ assert return_dict["restricted_download_count_ja"] == "無制限"
+ assert return_dict["restricted_download_count_en"] == "Unlimited"
+ assert return_dict['restricted_expiration_date'] == (datetime.date.today() + timedelta(1)).strftime("%Y-%m-%d")
+ assert return_dict['restricted_expiration_date_ja'] == ""
+ assert return_dict['restricted_expiration_date_en'] == ""
+
+ #62
+ #63
+ #test No.4(W2023-22 2)
+ from re import match
+ assert match("^.+record\/" + record_id + "\/file\/secret\/"+file_name+"\?token=.+=$",return_dict["secret_url"])
+ assert return_dict["secret_url"] != ""
+ assert return_dict["mail_recipient"] == user_mail
+
+
+# def parse_secret_download_token(token: str) -> Tuple[str, Tuple]:
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py::test_parse_secret_download_token -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_parse_secret_download_token(app ,db):
+ #64
+ assert parse_secret_download_token(None) == (_("Token is invalid."),())
+ assert parse_secret_download_token("") == (_("Token is invalid."),())
+ #65
+ assert parse_secret_download_token("random_string sajfosijdfasodfjv") == (_("Token is invalid."),())
+
+
+ # 66
+ # onetime_download pattern
+ assert parse_secret_download_token("MSB1c2VyQGV4YW1wbGUub3JnIDIwMjItMDktMjcgNDBDRkNGODFGM0FFRUI0Ng==") == (_("Token is invalid."),())
+
+ # 67
+ # secret_download pattern
+ error , res = parse_secret_download_token("MSA1IDIwMjMtMDMtMDggMDA6NTI6MTkuNjI0NTUyIDZGQTdEMzIxQTk0OTU1MEQ=")
+ assert not error
+ assert res == ('1', '5', '2023-03-08 00:52:19.624552', '6FA7D321A949550D')
+
+# def validate_secret_download_token(
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py::test_validate_secret_download_token -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_validate_secret_download_token(app):
+
+ with app.test_request_context():
+ secret_download=FileSecretDownload(
+ file_name= "eee.txt", record_id= '1',user_mail="repoadmin@example.org",expiration_date=999999,download_count=10
+ )
+ secret_download.created = datetime(2023,3,8,0,52,19,624552)
+ secret_download.id = 5
+ # 68
+ res = validate_secret_download_token(secret_download=None , file_name= "eee.txt", record_id= '1', id= '5', date= '2023-03-08 00:52:19.624552', token= '6FA7D321A949550D')
+ assert res == (False , _("Token is invalid."))
+
+ #69
+ res = validate_secret_download_token(secret_download=secret_download , file_name= "aaa.txt", record_id= '1', id= '5', date= '2023-03-08 00:52:19.624552', token= '6FA7D321A949550D')
+ assert res == (False , _("Token is invalid."))
+ res = validate_secret_download_token(secret_download=secret_download , file_name= "eee.txt", record_id= '5', id= '5', date= '2023-03-08 00:52:19.624552', token= '6FA7D321A949550D')
+ assert res == (False , _("Token is invalid."))
+ res = validate_secret_download_token(secret_download=secret_download , file_name= "eee.txt", record_id= '1', id= '1', date= '2023-03-08 00:52:19.624552', token= '6FA7D321A949550D')
+ assert res == (False , _("Token is invalid."))
+ res = validate_secret_download_token(secret_download=secret_download , file_name= "eee.txt", record_id= '1', id= '5', date= '2099-03-08 00:52:19.624552', token= '6FA7D321A949550D')
+ assert res == (False , _("Token is invalid."))
+ res = validate_secret_download_token(secret_download=secret_download , file_name= "eee.txt", record_id= '1', id= '5', date= '2023-03-08 00:52:19.624552', token= '7FA7D321A949550D')
+ assert res == (False , _("Token is invalid."))
+
+ # 70
+ secret_download2=FileSecretDownload(
+ file_name= "eee.txt", record_id= '5',user_mail="repoadmin@example.org",expiration_date=-1,download_count=10
+ )
+ secret_download2.created = datetime(2023,3,8,0,52,19,624552)
+ secret_download2.id = 5
+ res = validate_secret_download_token(secret_download=secret_download2 , file_name= "eee.txt", record_id= '1', id= '5', date= '2023-03-08 00:52:19.624552', token= '6FA7D321A949550D')
+ assert res == (False , _("The expiration date for download has been exceeded."))
+
+ #71
+ secret_download2.expiration_date = 99999999
+ res = validate_secret_download_token(secret_download=secret_download2 , file_name= "eee.txt", record_id= '1', id= '5', date= '2023-03-08 00:52:19.624552', token= '6FA7D321A949550D')
+ assert res == (True ,"")
+
+ # 72
+ secret_download2.expiration_date = 9999999
+ secret_download2.download_count = 0
+ res = validate_secret_download_token(secret_download=secret_download2 , file_name= "eee.txt", record_id= '1', id= '5', date= '2023-03-08 00:52:19.624552', token= '6FA7D321A949550D')
+ assert res == (False , _("The download limit has been exceeded."))
+
+ # 73
+ res = validate_secret_download_token(secret_download=secret_download , file_name= "eee.txt", record_id= '1', id= '5', date= '2023-03-08 00:52:19.624552', token= '6FA7D321A949550D')
+ assert res == (True ,"")
+
+ secret_download2.expiration_date = "hoge"
+ res = validate_secret_download_token(secret_download=secret_download2 , file_name= "eee.txt", record_id= '1', id= '5', date= '2023-03-08 00:52:19.624552', token= '6FA7D321A949550D')
+ assert res == (False , _("Token is invalid."))
+
+# def get_secret_download(file_name: str, record_id: str,
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py::test_get_secret_download -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_get_secret_download(app ,db ):
+ with app.test_request_context():
+ with db.session.begin_nested():
+ secret_download=FileSecretDownload(
+ file_name= "eee.txt", record_id= '1',user_mail="repoadmin@example.org",expiration_date=999999,download_count=10
+ )
+ db.session.add(secret_download)
+
+
+
+ assert get_secret_download(file_name= secret_download.file_name
+ , record_id= secret_download.record_id
+ , id= secret_download.id
+ , created =secret_download.created)
+
+ assert not get_secret_download(file_name= secret_download.file_name
+ , record_id= secret_download.record_id
+ , id= secret_download.id + 1
+ , created =secret_download.created)
+
+# def update_secret_download(**kwargs) -> Optional[List[FileSecretDownload]]:
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_utils.py::test_get_data_usage_application_data -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_get_data_usage_application_data(app ,db):
+ with app.test_request_context():
+ with db.session.begin_nested():
+ secret_download=FileSecretDownload(
+ file_name= "eee.txt", record_id= '1',user_mail="repoadmin@example.org",expiration_date=999999,download_count=10
+ )
+ db.session.add(secret_download)
+ update_data = dict(
+ file_name = secret_download.file_name
+ , record_id = secret_download.record_id
+ , download_count = 100
+ , created = secret_download.created
+ , id = secret_download.id
+ )
+ res = update_secret_download(**update_data)
+ assert len(res) == 1
+ assert res[0].download_count == 100
+
diff --git a/modules/weko-records-ui/tests/test_views.py b/modules/weko-records-ui/tests/test_views.py
index 2eb84d6b72..33066be27f 100644
--- a/modules/weko-records-ui/tests/test_views.py
+++ b/modules/weko-records-ui/tests/test_views.py
@@ -1,12 +1,14 @@
from unittest.mock import MagicMock
+import uuid
import pytest
import io
-from flask import Flask, json, jsonify, session, url_for
+from flask import Flask, json, jsonify, session, url_for ,make_response
from flask_security.utils import login_user
from invenio_accounts.testutils import login_user_via_session
+from invenio_mail.models import MailTemplateGenres
from mock import patch
from weko_deposit.api import WekoRecord
-from werkzeug.exceptions import NotFound
+from werkzeug.exceptions import NotFound ,Forbidden
from sqlalchemy.orm.exc import MultipleResultsFound
from jinja2.exceptions import TemplatesNotFound
from weko_workflow.models import (
@@ -19,6 +21,7 @@
WorkFlow,
)
from weko_records_ui.views import (
+ _get_show_secret_url_button,
check_permission,
citation,
escape_newline,
@@ -43,10 +46,12 @@
get_file_permission,
check_content_file_clickable,
get_usage_workflow,
+ get_item_usage_workflow,
get_workflow_detail,
preview_able,
get_uri,
)
+from weko_records_ui.config import WEKO_RECORDS_UI_MAIL_TEMPLATE_SECRET_GENRE_ID
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_views.py -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
@@ -320,14 +325,14 @@ def test_check_file_permission(app,records,users,id,result):
@pytest.mark.parametrize(
"id, result",
[
- (0, True),
+ # (0, True),
# (1, True),
# (2, True),
# (3, True),
# (4, True),
# (5, True),
# (6, True),
- # (7, True),
+ (7, True), # id=1
],
)
def test_check_file_permission_period(app,records,db_file_permission,users,id,result):
@@ -337,7 +342,8 @@ def test_check_file_permission_period(app,records,db_file_permission,users,id,re
fjson = record['item_1617605131499']['attribute_value_mlt'][0]
# fjson = {'url': {'url': 'https://weko3.example.org/record/11/files/001.jpg'}, 'date': [{'dateType': 'Available', 'dateValue': '2022-09-27'}], 'format': 'image/jpeg', 'filename': 'helloworld.pdf', 'filesize': [{'value': '2.7 MB'}], 'accessrole': 'open_access', 'version_id': 'd73bd9cb-aa9e-4cd0-bf07-c5976d40bdde', 'displaytype': 'preview', 'is_thumbnail': False, 'future_date_message': '', 'download_preview_message': '', 'size': 2700000.0, 'mimetype': 'image/jpeg', 'file_order': 0}
with patch("flask_login.utils._get_user", return_value=users[id]["obj"]):
- assert check_file_permission_period(record,fjson)==result
+ with patch("weko_records_ui.views.check_permission_period" , return_value=True):
+ assert check_file_permission_period(record,fjson)==result
# data1 = MagicMock()
# data2 = MagicMock()
@@ -363,8 +369,9 @@ def test_get_file_permission(app,records,users,id,result,db_file_permission):
indexer, results = records
record = results[0]["record"]
assert isinstance(record,WekoRecord)==True
- with patch("flask_login.utils._get_user", return_value=users[id]["obj"]):
- assert get_file_permission(record,record['item_1617605131499']['attribute_value_mlt'][0])==result
+ with app.test_request_context():
+ with patch("flask_login.utils._get_user", return_value=users[id]["obj"]):
+ assert get_file_permission(record,record['item_1617605131499']['attribute_value_mlt'][0])==result
# def check_content_file_clickable(record, fjson):
@@ -387,7 +394,8 @@ def test_check_content_file_clickable(app,records,users,id,result):
record = results[0]["record"]
assert isinstance(record,WekoRecord)==True
with patch("flask_login.utils._get_user", return_value=users[id]["obj"]):
- assert check_content_file_clickable(record,record['item_1617605131499'])==result
+ with patch("weko_records_ui.permissions.check_open_restricted_permission", return_value=False):
+ assert check_content_file_clickable(record,record['item_1617605131499'])==False
# def get_usage_workflow(file_json):
@@ -418,25 +426,52 @@ def test_get_usage_workflow(app, users, workflows):
with patch("flask_login.utils._get_user", return_value=data1):
res = get_usage_workflow(_file_json)
- assert res==3
+ assert res=="3"
+# def get_item_usage_workflow(record)
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_views.py::test_get_item_usage_workflow -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_get_item_usage_workflow(records):
+ indexer, results = records
+ record = results[0]["record"]
+ provide_list = {"workflow":"1", "terms":"term_free", "termsDescription":"利用規約自由入力"}
+ with patch("weko_records_ui.views.get_item_provide_list",return_value=provide_list):
+ class Mocklocale:
+ id = 0
+ def get_language_name(self, bbb):
+ return "Japanese"
+ with patch("weko_records_ui.views.get_locale", return_value = Mocklocale()):
+ terms=["利用規約自由入力", "Terms of Use Free Input"]
+ with patch("weko_records_ui.views.extract_term_description",return_value =terms):
+ terms, provide= get_item_usage_workflow(record)
+ assert terms == "利用規約自由入力"
+ assert provide == "1"
+
+ provide_list = {"workflow":"1", "terms":"1111111111"}
+ with patch("weko_records_ui.views.get_item_provide_list",return_value=provide_list):
+ with patch("weko_records_ui.views.get_locale") as pi:
+ terms=["", "Terms of Use Free Input"]
+ with patch("weko_records_ui.views.extract_term_description",return_value =terms):
+ pi.get_language_name = MagicMock()
+ terms, provide= get_item_usage_workflow(record)
+ assert terms == "Terms of Use Free Input"
+ assert provide == "1"
# def get_workflow_detail(workflow_id):
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_views.py::test_get_workflow_detail -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
def test_get_workflow_detail(app,workflows):
wf = workflows['workflow']
- ret = get_workflow_detail(wf.id)
- assert isinstance(wf,WorkFlow)
+ ret,isterm = get_workflow_detail(wf.id)
+ assert isinstance(ret,WorkFlow) and isinstance(isterm,bool)
with pytest.raises(NotFound):
- ret = get_workflow_detail(0)
+ ret,isterm = get_workflow_detail(0)
# def default_view_method(pid, record, filename=None, template=None, **kwargs):
# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_views.py::test_default_view_method -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
# """Display default view.
# def _get_rights_title(result, rights_key, rights_values, current_lang, meta_options):
-def test_default_view_method(app, records, itemtypes, indexstyle):
+def test_default_view_method(app, records, itemtypes, indexstyle ,users):
indexer, results = records
record = results[0]["record"]
recid = results[0]["recid"]
@@ -444,12 +479,120 @@ def test_default_view_method(app, records, itemtypes, indexstyle):
with patch('weko_records_ui.views.check_original_pdf_download_permission', return_value=True):
with patch("weko_records_ui.views.get_search_detail_keyword", return_value={}):
with patch("weko_records_ui.views.get_index_link_list", return_value=[]):
- # need to fix
- with pytest.raises(Exception) as e:
- res = default_view_method(recid, record, 'helloworld.pdf')
- assert e.type==TemplatesNotFound
+ with patch("weko_records_ui.views.render_template", return_value=make_response()):
+ assert default_view_method(recid, record, 'helloworld.pdf').status_code == 200
+ # # need to fix
+ # with pytest.raises(Exception) as e:
+ # res = default_view_method(recid, record, 'helloworld.pdf')
+ # assert e.type==TemplatesNotFound
+
+ default_view_method(recid, record )
+ with pytest.raises(NotFound) : #404
+ default_view_method(recid, record ,'notfound.pdf')
+ with pytest.raises(NotFound) : #404
+ default_view_method(recid, record ,'[No FileName]')
+
+ def cannnot():
+ return False
+ file_permission_factory = MagicMock()
+ file_permission_factory.can = cannnot
+ with patch('weko_records_ui.views.file_permission_factory', return_value=file_permission_factory):
+ with patch('weko_records_ui.views._redirect_method', return_value="redirect"):
+ assert default_view_method(recid, record ,'helloworld.pdf') == "redirect"
+ with patch("flask_login.utils._get_user", return_value=users[3]["obj"]):
+ with pytest.raises(Forbidden) : #404
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
+ with patch('weko_records_ui.views.is_show_email_of_creator', return_value=True):
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
+ with patch('weko_records_ui.views.AdminSettings.get'
+ , side_effect=lambda name , dict_to_object : {'display_stats' : False} if name == 'display_stats_settings' else None):
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
+ with patch('weko_records_ui.views.AdminSettings.get'
+ , side_effect=lambda name , dict_to_object : {'items_search_author' : "author"} if name == 'items_display_settings' else None):
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
+ with patch('weko_search_ui.utils.get_data_by_property', return_value=(False,False)):
+ with patch('weko_records_ui.views.selected_value_by_language' ,return_value="helloworld.pdf"):
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
+ with patch('weko_records_ui.views.get_record_permalink', return_value=False):
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
+
+ record.update(
+ {'system_identifier_doi' :
+ {"attribute_value_mlt" :[{'subitem_systemidt_identifier':"permalink_uri"}]}})
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
+
+
+ def side_effect(arg):
+ values = ['a', 'b']
+ return values[arg]
+ # with patch('weko_search_ui.utils.get_sub_item_value', side_effect=side_effect):
+ # default_view_method(recid, record ,'helloworld.pdf')
+ pid_ver = MagicMock
+ pid_ver.exists = False
+ with patch('weko_records_ui.views.PIDVersioning',return_value=pid_ver):
+ with pytest.raises(NotFound) : #404
+ assert default_view_method(recid, record ,'helloworld.pdf')
+
+ pid_ver = MagicMock
+ pid_ver.exists = True
+ pid_ver.is_last_child = False
+ mock = MagicMock
+ mock.object_uuid = uuid.uuid4()
+ pid_ver.children = [mock]
+ pid_ver.get_children = lambda ordered,pid_status : [mock]
+ with patch('weko_records_ui.views.PIDVersioning',return_value=pid_ver):
+ with patch('weko_records_ui.views.WekoRecord.get_record',return_value={'_deposit':{'status':'draft'}}):
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
+
+ with patch('weko_records_ui.views.WekoRecord.get_record',side_effect=Exception):
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
+ with patch('weko_records_ui.views.ItemLink.get_item_link_info',return_value={"relation":"res"}):
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
+
+ index = MagicMock()
+ index.index_name = ""
+ index.index_name_english ="index"
+ with patch('weko_records_ui.views.Indexes.get_index',return_value=index):
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
+
+ #test No.6(W2023-22 3-5)
+ restricted_errorMsg = {"content_file_download": {"expiration_date": 30,"expiration_date_unlimited_chk": False,"download_limit": 10,"download_limit_unlimited_chk": False,},"usage_report_workflow_access": {"expiration_date_access": 500,"expiration_date_access_unlimited_chk": False,},"terms_and_conditions": [],"error_msg":{"key" : "","content" : {"ja" : {"content" : "このデータは利用できません(権限がないため)。"},"en":{"content" : "This data is not available for this user"}}}}
+ with patch('weko_admin.utils.get_restricted_access' ,return_value = restricted_errorMsg):
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
+
+ with patch('weko_records_ui.views.AdminSettings.get'
+ , side_effect=lambda name , dict_to_object : {'password_enable' : True,"terms_and_conditions":""} if name == 'restricted_access' else None):
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
- meta_options
+
+# def default_view_method(pid, record, filename=None, template=None, **kwargs):
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_views.py::test_default_view_method2 -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+# """Display default view.
+# def _get_rights_title(result, rights_key, rights_values, current_lang, meta_options):
+def test_default_view_method2(app, records, itemtypes, indexstyle ,users,db_community):
+ indexer, results = records
+ record = results[0]["record"]
+ recid = results[0]["recid"]
+ with app.test_request_context("/?file_order=0&community=community&onetime_file_url=/extra_info"):
+ with patch('weko_records_ui.views.check_original_pdf_download_permission', return_value=True):
+ with patch("weko_records_ui.views.get_search_detail_keyword", return_value={}):
+ with patch("weko_records_ui.views.get_index_link_list", return_value=[]):
+ with patch("weko_records_ui.views.render_template", return_value=make_response()):
+
+ assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200
+
+ with patch('weko_workflow.api.GetCommunity.get_community_by_id',return_value=[]):
+ with pytest.raises(AttributeError):
+ default_view_method(recid, record ,'[No FileName]')
+
+ del record["item_1617605131499"]["attribute_value_mlt"][0]["filename"]
+ with pytest.raises(NotFound) : #404
+ default_view_method(recid, record ,'helloworld.pdf')
+
+ del record["item_1617605131499"] # files
+ with pytest.raises(NotFound) : #404
+ default_view_method(recid, record ,'helloworld.pdf')
+
# def doi_ish_view_method(parent_pid_value=0, version=0):
@@ -795,3 +938,144 @@ def test_get_uri(app,client,db_sessionlifetime,records):
res = client.post(url,data=json.dumps({"uri":"https://localhost/001.jpg","pid_value":"1","accessrole":"1"}), content_type='application/json')
assert res.status_code == 200
assert json.loads(res.data)=={'status': True}
+
+# def create_secret_url_and_send_mail(pid:PersistentIdentifier, record:WekoRecord, filename:str, **kwargs) -> str:
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_views.py::test_create_secret_url_and_send_mail -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_create_secret_url_and_send_mail(app,client,db,users,records,db_restricted_access_secret,db_mailTemplateGenre,db_mailtemplates):
+ indexer, results = records
+ record = results[1]
+
+ # 79
+ id = 1 #repoadmin
+ secret_file_url = url_for("invenio_records_ui.recid_secret_url"
+ ,pid_value=results[1]["recid"].pid_value
+ ,filename=results[1]["filename"])
+ login_user_via_session(client=client, user=users[id]["obj"] ,email=users[id]["email"])
+ with patch('weko_records_ui.views._get_show_secret_url_button',return_value = True):
+ with patch('weko_records_ui.views.process_send_mail',return_value = True):
+ #with app.test_request_context():
+ #W2023-22-2 TestNo.7
+ res = client.get(secret_file_url)
+ assert res.status_code == 405
+
+ #W2023-22-2 TestNo.4
+ res = client.post(secret_file_url ,data=json.dumps({}), content_type='application/json')
+ assert res.status_code == 200
+
+
+ #W2023-22-2 TestNo.6
+ with patch('weko_records_ui.views._get_show_secret_url_button',return_value = False):
+ with patch('weko_records_ui.views.process_send_mail',return_value = True):
+ with patch("flask.templating._render", return_value=""):
+ res = client.post(secret_file_url ,data=json.dumps({}), content_type='application/json')
+ assert res.status_code == 403
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_views.py::test_create_secret_url_and_send_mail_2 -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+def test_create_secret_url_and_send_mail_2(app,client,db,users,records,db_restricted_access_secret):
+ indexer, results = records
+ record = results[1]
+
+ # 79
+ id = 1 #repoadmin
+ secret_file_url = url_for("invenio_records_ui.recid_secret_url"
+ ,pid_value=results[1]["recid"].pid_value
+ ,filename=results[1]["filename"])
+ login_user_via_session(client=client, user=users[id]["obj"] ,email=users[id]["email"])
+ with patch('weko_records_ui.views._get_show_secret_url_button',return_value = True):
+ #W2023-22-2 TestNo.5
+ with patch('weko_records_ui.views.process_send_mail',return_value = False):
+ with patch("flask.templating._render", return_value=""):
+ res = client.post(secret_file_url ,data=json.dumps({}), content_type='application/json')
+ assert res.status_code == 500
+
+# def create_secret_url_and_send_mail(pid:PersistentIdentifier, record:WekoRecord, filename:str, **kwargs) -> str:
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_views.py::test__get_show_secret_url_button -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+@pytest.mark.parametrize(
+ "id, is_show",
+ [
+ (0, False), #contributor
+ (1, True), #repoadmin
+ (2, True), #sysadmin
+ (3, False), #comadmin
+ (4, False), #generaluser
+ (5, True), #originalroleuser (owner)
+ (6, True), #originalroleuser2 (repoadmin)
+ (7, False), #user (weko_shared owner)
+ ],
+)
+def test__get_show_secret_url_button(users,records ,db_restricted_access_secret,id ,is_show):
+ indexer, results = records
+ # 80
+ i = 0
+ role = ["open_access" , "open_no" ,"open_date"]
+ for record in results:
+ record["record"]['owner'] = users[5]["id"]
+ record["record"]['weko_shared_ids'] = [users[7]["id"]]
+ record["record"].get_file_data()[0].update({'accessrole':role[i]})
+ record["record"].get_file_data()[0].update({'date':[{"dateValue" :'2999-12-31'}]})
+ i = i + 1
+
+ with patch("flask_login.utils._get_user", return_value=users[id]["obj"]):
+ res = []
+ for record in results:
+ res.append( _get_show_secret_url_button(record["record"] , record["filename"]) )
+
+ assert not res[0]
+ assert res[1] == is_show
+ assert res[2] == is_show
+
+# def create_secret_url_and_send_mail(pid:PersistentIdentifier, record:WekoRecord, filename:str, **kwargs) -> str:
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_views.py::test__get_show_secret_url_button2 -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+@pytest.mark.parametrize(
+ "id, is_show",
+ [
+ (1, True), #repoadmin
+ ],
+)
+def test__get_show_secret_url_button2(users,records ,id,is_show):
+ indexer, results = records
+ # 80
+ # pattern of not db_restricted_access_secret
+ i = 0
+ role = ["open_access" , "open_no" ,"open_date"]
+ for record in results:
+ record["record"]['owner'] = users[5]["id"]
+ record["record"]['weko_shared_ids'] = [users[7]["id"]]
+ record["record"].get_file_data()[0].update({'accessrole':role[i]})
+ record["record"].get_file_data()[0].update({'date':[{"dateValue" :'2999-12-31'}]})
+ i = i + 1
+ with patch("flask_login.utils._get_user", return_value=users[id]["obj"]):
+ res = []
+ for record in results:
+ res.append( _get_show_secret_url_button(record["record"] , record["filename"]) )
+
+ assert res[0] == False
+ assert res[1] == False
+ assert res[2] == False
+
+# def create_secret_url_and_send_mail(pid:PersistentIdentifier, record:WekoRecord, filename:str, **kwargs) -> str:
+# .tox/c1/bin/pytest --cov=weko_records_ui tests/test_views.py::test__get_show_secret_url_button3 -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-records-ui/.tox/c1/tmp
+@pytest.mark.parametrize(
+ "id, is_show",
+ [
+ (1, True), #repoadmin
+ ],
+)
+def test__get_show_secret_url_button3(users,records ,db_restricted_access_secret,id,is_show):
+ indexer, results = records
+ # 80
+ i = 0
+ role = ["open_access" , "open_no" ,"open_date"]
+ for record in results:
+ record["record"]['owner'] = users[5]["id"]
+ record["record"]['weko_shared_ids'] = [users[7]["id"]]
+ record["record"].get_file_data()[0].update({'accessrole':role[i]})
+ record["record"].get_file_data()[0].update({'date':[{"dateValue" :'1999-12-31'}]})
+ i = i + 1
+ with patch("flask_login.utils._get_user", return_value=users[id]["obj"]):
+ res = []
+ for record in results:
+ res.append( _get_show_secret_url_button(record["record"] , record["filename"]) )
+
+ assert res[0] == False
+ assert res[1] == is_show
+ assert res[2] == False
diff --git a/modules/weko-records-ui/tox.ini b/modules/weko-records-ui/tox.ini
index 303553d191..7f40ba4a4d 100644
--- a/modules/weko-records-ui/tox.ini
+++ b/modules/weko-records-ui/tox.ini
@@ -61,13 +61,14 @@ commands =
pytest --cov=weko_records_ui tests -v --cov-report=term --basetemp="{envtmpdir}" {posargs}
[testenv:c1]
+setuptools_version = 57.5.0
passenv = LANG
deps =
pytest>=3
pytest-cov
-rrequirements.txt
commands =
- pytest --cov=weko_records_ui tests -v --cov-branch --cov-report=term --cov-report=xml --basetemp="{envtmpdir}" {posargs}
+ pytest --cov=weko_records_ui tests -v --cov-branch --cov-report=term --cov-report=html --cov-report=xml --basetemp="{envtmpdir}" {posargs}
[testenv:lint]
passenv = LANG
diff --git a/modules/weko-records-ui/weko_records_ui/__init__.py b/modules/weko-records-ui/weko_records_ui/__init__.py
index 6fa91ef95a..89cb413cf3 100644
--- a/modules/weko-records-ui/weko_records_ui/__init__.py
+++ b/modules/weko-records-ui/weko_records_ui/__init__.py
@@ -20,7 +20,7 @@
"""Module for displaying records."""
-from .ext import WekoRecordsCitesREST, WekoRecordsUI
+from .ext import WekoRecordsCitesREST, WekoRecordsUI, WekoRecordsREST
from .version import __version__
-__all__ = ('__version__', 'WekoRecordsUI', 'WekoRecordsCitesREST')
+__all__ = ('__version__', 'WekoRecordsUI', 'WekoRecordsCitesREST', 'WekoRecordsREST')
diff --git a/modules/weko-records-ui/weko_records_ui/admin.py b/modules/weko-records-ui/weko_records_ui/admin.py
index 6a473da9b6..8ed20101a0 100644
--- a/modules/weko-records-ui/weko_records_ui/admin.py
+++ b/modules/weko-records-ui/weko_records_ui/admin.py
@@ -58,8 +58,13 @@ def index(self):
check_items_settings()
email_display_flg = '0'
search_author_flg = 'name'
- open_date_display_flg = current_app.config.get(
- 'OPEN_DATE_HIDE_VALUE')
+ open_date_display_flg = current_app.config.get('OPEN_DATE_HIDE_VALUE')
+ is_display_request_form = current_app.config.get('DISPLAY_REQUEST_FORM', False)
+ # Get display request form settings
+ items_display_settings = AdminSettings.get('items_display_settings')
+ if items_display_settings:
+ is_display_request_form = items_display_settings.__dict__.get('display_request_form')
+
if current_app.config['EMAIL_DISPLAY_FLG']:
email_display_flg = '1'
if 'ITEM_SEARCH_FLG' in current_app.config:
@@ -72,33 +77,38 @@ def index(self):
# Process forms
form = request.form.get('submit', None)
if form == 'set_search_author_form':
- settings = AdminSettings.get('items_display_settings')
+ settings = items_display_settings.__dict__
email_display_flg = request.form.get('displayRadios', '0')
- if email_display_flg == '1':
- settings.items_display_email = True
- else:
- settings.items_display_email = False
- open_date_display_flg = request.form.get(
- 'openDateDisplayRadios', '0')
- if open_date_display_flg == '1':
- settings.item_display_open_date = True
- else:
- settings.item_display_open_date = False
- AdminSettings.update('items_display_settings',
- settings.__dict__)
+ is_email_display = (email_display_flg == '1')
+ settings['items_display_email'] = is_email_display
+
+ open_date_display_flg = request.form.get('openDateDisplayRadios', '0')
+ is_open_date_display = open_date_display_flg == '1'
+ settings['item_display_open_date'] = is_open_date_display
+
+ request_form_display_value = request.form.get('requestFormDisplayRadios', '0')
+ is_display_request_form = request_form_display_value == '1'
+ settings['display_request_form'] = is_display_request_form
+
+ AdminSettings.update('items_display_settings', settings)
flash(_('Author flag was updated.'), category='success')
return self.render(config.ADMIN_SET_ITEM_TEMPLATE,
search_author_flg=search_author_flg,
email_display_flg=email_display_flg,
open_date_display_flg=open_date_display_flg,
+ is_request_form_display=is_display_request_form,
form=form)
except BaseException:
+ import traceback
+ exc, val, tb = sys.exc_info()
current_app.logger.error(
'Unexpected error: {}'.format(sys.exc_info()))
+ current_app.logger.error(
+ traceback.format_exception(exc, val, tb)
+ )
return abort(400)
-
class PdfCoverPageSettingView(BaseView):
"""PdfCover Page settings."""
diff --git a/modules/weko-records-ui/weko_records_ui/api.py b/modules/weko-records-ui/weko_records_ui/api.py
new file mode 100644
index 0000000000..9e9432a7ab
--- /dev/null
+++ b/modules/weko-records-ui/weko_records_ui/api.py
@@ -0,0 +1,162 @@
+from datetime import datetime
+import random
+import string
+from email_validator import validate_email
+from flask import current_app
+from flask_mail import Message
+import hashlib
+from invenio_db import db
+from invenio_mail.admin import _load_mail_cfg_from_db, _set_flask_mail_cfg
+
+
+from weko_records.api import RequestMailList
+from weko_records.models import ItemApplication
+from weko_records_ui.captcha import get_captcha_info
+from weko_records_ui.errors import AuthenticationRequiredError, ContentsNotFoundError, InternalServerError, InvalidCaptchaError, InvalidEmailError, RequiredItemNotExistError
+from weko_redis.redis import RedisConnection
+
+def send_request_mail(item_id, mail_info):
+
+ # Validate token
+ captcha_key = mail_info.get('key')
+ authorization_token = mail_info.get('authorization_token')
+ if not captcha_key or not authorization_token:
+ raise RequiredItemNotExistError()
+
+ redis_connection = RedisConnection()
+ datastore = redis_connection.connection(db=current_app.config['CACHE_REDIS_DB'])
+ captcha_info = datastore.hgetall(captcha_key)
+ encoded_token = captcha_info.get('authorization_token'.encode())
+ if encoded_token is None or authorization_token is None or \
+ (encoded_token.decode() != authorization_token):
+ raise AuthenticationRequiredError()
+
+ # Get mail recipients
+ recipients_json = RequestMailList.get_mail_list_by_item_id(item_id)
+ recipients_email = [ele['email'] for ele in recipients_json]
+ if not recipients_email:
+ raise ContentsNotFoundError()
+
+ # Get request mail info
+ msg_sender = mail_info.get('from')
+ msg_subject = mail_info.get('subject')
+ msg_message = mail_info.get('message')
+ if not msg_sender or not msg_subject or not msg_message:
+ raise RequiredItemNotExistError()
+ msg_body = msg_sender + current_app.config.get("WEKO_RECORDS_UI_REQUEST_MESSAGE") + mail_info['message']
+
+ # Validate request mail sender
+ try :
+ validate_email(msg_sender, check_deliverability=False)
+ except Exception:
+ # Invalid email
+ raise InvalidEmailError() # 400 Error
+
+ try:
+ mail_cfg = _load_mail_cfg_from_db()
+ _set_flask_mail_cfg(mail_cfg)
+ msg = Message(
+ msg_subject,
+ recipients=recipients_email,
+ body=msg_body
+ )
+ current_app.extensions['mail'].send(msg)
+ notification_msg_body = current_app.config.get("WEKO_RECORDS_UI_NOTIFICATION_MESSAGE") + mail_info['message']
+ notification_msg = Message(
+ msg_subject,
+ recipients = [msg_sender],
+ body = notification_msg_body
+ )
+ current_app.extensions['mail'].send(notification_msg)
+ except Exception:
+ current_app.logger.exception('Sending Email handles unexpected error.')
+ raise InternalServerError() # 500
+
+ # Create response
+ res_json = {
+ "from": msg_sender,
+ "subject": msg_subject,
+ "message": msg_body
+ }
+ return True, res_json
+
+def validate_captcha_answer(captcha_answer):
+
+ expiration_seconds = current_app.config.get('WEKO_RECORDS_UI_CAPTCHA_EXPIRATION_SECONDS', 900)
+
+ # Validate CAPTCHA
+ captcha_key = captcha_answer.get('key')
+ calculation_result = captcha_answer.get('calculation_result')
+ if not captcha_key or (not calculation_result and calculation_result != 0):
+ raise RequiredItemNotExistError()
+
+ redis_connection = RedisConnection()
+ datastore = redis_connection.connection(db=current_app.config['CACHE_REDIS_DB'])
+ captcha_answer = datastore.hgetall(captcha_key)
+ encoded_calc_answer = captcha_answer.get('calculation_result'.encode())
+ # if calculation validation failed
+ if encoded_calc_answer is None or calculation_result is None or \
+ (int(encoded_calc_answer.decode()) != calculation_result):
+ # delete Redis info
+ datastore.delete(captcha_key)
+ raise InvalidCaptchaError()
+
+ authorization_token = captcha_answer.get('authorization_token'.encode())
+
+ # Reset expiration seconds
+ datastore.expire(captcha_key, expiration_seconds)
+
+ # Create response
+ res_json = {
+ "authorization_token": authorization_token
+ }
+ return True, res_json
+
+def create_captcha_image():
+
+ expiration_seconds = current_app.config.get('WEKO_RECORDS_UI_CAPTCHA_EXPIRATION_SECONDS', 900)
+ ttl = min(expiration_seconds, current_app.config.get('WEKO_RECORDS_UI_CAPTCHA_TTL_SECONDS', expiration_seconds))
+
+ # Get CAPTCHA info
+ captcha_info = get_captcha_info()
+
+ # Create key
+ current_dt = datetime.now()
+ random_salt = ''.join([random.choice(string.ascii_letters + string.digits) for _ in range(10)])
+ key = hashlib.sha1((current_dt.strftime('%Y/%m/%d-%H:%M:%S') + random_salt).encode()).hexdigest()
+
+ # Create Authorization custom token
+ random_salt = ''.join([random.choice(string.ascii_letters + string.digits) for _ in range(10)])
+ authorization_token = hashlib.sha256((current_dt.strftime('%Y/%m/%d-%H:%M:%S') + random_salt).encode()).hexdigest()
+
+ # Set calculation answer and authorization token
+ redis_connection = RedisConnection()
+ datastore = redis_connection.connection(db=current_app.config['CACHE_REDIS_DB'])
+ datastore.hset(key, 'calculation_result', captcha_info['answer'])
+ datastore.hset(key, 'authorization_token', authorization_token)
+ datastore.expire(key, expiration_seconds)
+
+ # Create response
+ res_json = {
+ "key": key,
+ 'image': captcha_info['image'],
+ 'ttl': ttl
+ }
+ return True, res_json
+
+def get_item_provide_list(item_id):
+ if not item_id:
+ return {}
+
+ item_application_info = None
+ try:
+ with db.session.no_autoflush:
+ item_application_info = db.session.query(ItemApplication) \
+ .filter_by(item_id=item_id).first()
+ except Exception:
+ current_app.logger.exception('Item provide list query failed.')
+
+ if item_application_info:
+ return item_application_info.item_application
+ else:
+ return {}
\ No newline at end of file
diff --git a/modules/weko-records-ui/weko_records_ui/captcha.py b/modules/weko-records-ui/weko_records_ui/captcha.py
new file mode 100644
index 0000000000..e33d3c5df1
--- /dev/null
+++ b/modules/weko-records-ui/weko_records_ui/captcha.py
@@ -0,0 +1,136 @@
+import base64
+import random
+import typing as t
+from captcha.image import ImageCaptcha, random_color
+from PIL.Image import new as createImage, Image, QUAD, BILINEAR
+from PIL.ImageDraw import Draw, ImageDraw
+from PIL.ImageFilter import SMOOTH
+
+ColorTuple = t.Union[t.Tuple[int, int, int], t.Tuple[int, int, int, int]]
+
+class ImageCaptchaEx(ImageCaptcha):
+ lookup_table: t.List[int] = [int(i * 1.97) for i in range(256)]
+
+ def _draw_character(
+ self,
+ c: str,
+ draw: ImageDraw,
+ color: ColorTuple) -> Image:
+ font = random.choice(self.truefonts)
+ _, _, w, h = draw.multiline_textbbox((1, 1), c, font=font)
+
+ dx1 = random.randint(0, 4)
+ dy1 = random.randint(0, 6)
+ im = createImage('RGBA', (w + dx1, h + dy1))
+ Draw(im).text((dx1, dy1), c, font=font, fill=color)
+
+ # rotate
+ if (c != '+') and (c != '-'):
+ im = im.crop(im.getbbox())
+ im = im.rotate(random.uniform(-30, 30), BILINEAR, expand=True)
+
+ # warp
+ dx2 = w * random.uniform(0.1, 0.3)
+ dy2 = h * random.uniform(0.2, 0.3)
+ x1 = int(random.uniform(-dx2, dx2))
+ y1 = int(random.uniform(-dy2, dy2))
+ x2 = int(random.uniform(-dx2, dx2))
+ y2 = int(random.uniform(-dy2, dy2))
+ w2 = w + abs(x1) + abs(x2)
+ h2 = h + abs(y1) + abs(y2)
+ data = (
+ x1, y1,
+ -x1, h2 - y2,
+ w2 + x2, h2 + y2,
+ w2 - x2, -y1,
+ )
+ im = im.resize((w2, h2))
+ im = im.transform((w, h), QUAD, data)
+ else:
+ im = im.resize((w + dx1, int(1.5*h)))
+ im = im.crop((int((w + dx1) / 2.0 - w), int(0.6*h), int((w + dx1) / 2.0 + w) , int(0.6*h)+h))
+ return im
+
+ def create_captcha_image(
+ self,
+ chars: str,
+ color: ColorTuple,
+ background: ColorTuple) -> Image:
+ """Create the CAPTCHA image itself.
+
+ :param chars: text to be generated.
+ :param color: color of the text.
+ :param background: color of the background.
+
+ The color should be a tuple of 3 numbers, such as (0, 255, 255).
+ """
+ image = createImage('RGB', (self._width, self._height), background)
+ draw = Draw(image)
+
+ images: t.List[Image] = []
+ for c in chars:
+ if random.random() > 0.5:
+ images.append(self._draw_character(" ", draw, color))
+ images.append(self._draw_character(c, draw, color))
+
+ text_width = sum([im.size[0] for im in images])
+
+ width = max(text_width, self._width)
+ image = image.resize((width, self._height))
+
+ average = int(text_width / len(chars))
+ rand = int(0.25 * average)
+ offset = int(average * 0.1)
+
+ for im in images:
+ w, h = im.size
+ mask = im.convert('L').point(self.lookup_table)
+ image.paste(im, (offset, int((self._height - h) / 2)), mask)
+ offset = offset + w + random.randint(-rand, 0)
+
+ if width > self._width:
+ image = image.resize((self._width, self._height))
+
+ return image
+
+ def generate_image(self, chars: str) -> Image:
+ """Generate the image of the given characters.
+
+ :param chars: text to be generated.
+ """
+ background = random_color(238, 255)
+ color = random_color(10, 200, random.randint(220, 255))
+ im = self.create_captcha_image(chars, color, background)
+ self.create_noise_dots(im, color, width=6, number=100)
+ self.create_noise_curve(im, color)
+ im = im.filter(SMOOTH)
+ return im
+
+
+def get_captcha_info():
+ ascii_letters = 'abdefhijkmnprtuvwy'
+ val1 = random.randint(10, 99)
+ val2 = random.randint(10, 99)
+ question = list()
+ answer = 0
+ if random.random() > 0.5 :
+ if val1 > val2:
+ question = list(str(val1) + '-' + str(val2))
+ answer = val1 - val2
+ else:
+ question = list(str(val2) + '-' + str(val1))
+ answer = val2 - val1
+ else:
+ question = list(str(val1) + '+' + str(val2))
+ answer = val1 + val2
+
+ for _ in range(3):
+ letter = random.choice(ascii_letters)
+ question.insert(random.randint(0, len(question)), letter)
+
+ image = ImageCaptchaEx(width=360, height=78).generate(''.join(question))
+
+ return {
+ 'image': base64.b64encode(image.getvalue()),
+ 'answer': answer
+ }
diff --git a/modules/weko-records-ui/weko_records_ui/config.py b/modules/weko-records-ui/weko_records_ui/config.py
index ad427a5d8b..813d019c05 100644
--- a/modules/weko-records-ui/weko_records_ui/config.py
+++ b/modules/weko-records-ui/weko_records_ui/config.py
@@ -70,6 +70,9 @@
OPEN_DATE_HIDE_VALUE = '0'
# setting the release date if display
+DISPLAY_REQUEST_FORM = False
+# Default setting whether to display the request form
+
# CSL Citation Formatter
# ======================
#: Styles Endpoint for CSL
@@ -168,6 +171,22 @@
route='/record//file/onetime/',
view_imp='weko_records_ui.fd.file_download_onetime',
record_class='weko_deposit.api:WekoRecord',
+ methods=['GET','POST'],
+ ),
+ recid_secret_url=dict(
+ pid_type='recid',
+ route='/records//secret/',
+ view_imp='weko_records_ui.views.create_secret_url_and_send_mail',
+ record_class='weko_deposit.api:WekoRecord',
+ permission_factory_imp='weko_records_ui.permissions'
+ ':page_permission_factory',
+ methods=['POST'],
+ ),
+ recid_secret_file_download=dict(
+ pid_type='recid',
+ route='/record//file/secret/',
+ view_imp='weko_records_ui.fd.file_download_secret',
+ record_class='weko_deposit.api:WekoRecord',
),
)
@@ -178,6 +197,14 @@
"filename={} record_id={} user_mail={} date={}"
"""Onetime download pattern."""
+WEKO_RECORDS_UI_SECRET_DOWNLOAD_PATTERN = \
+ "filename={} record_id={} id={} date={}"
+"""Secret URL download pattern."""
+
+WEKO_RECORDS_UI_MAIL_TEMPLATE_SECRET_URL = "email_pattern_send_secret_url.tpl"
+
+WEKO_RECORDS_UI_MAIL_TEMPLATE_SECRET_GENRE_ID = 1
+
RECORDS_UI_EXPORT_FORMATS = {
'recid': {
# 'junii2': dict(
@@ -520,7 +547,7 @@
RECORDS_UI_TOMBSTONE_TEMPLATE = 'weko_records_ui/tombstone.html'
# Setting the template of showing deleted record
-WEKO_RECORDS_UI_LANG_DISP_FLG = False
+WEKO_RECORDS_UI_LANG_DISP_FLG = False
""" Enable function of switching metadata by language of metadata """
WEKO_RECORDS_UI_GOOGLE_SCHOLAR_OUTPUT_RESOURCE_TYPE = [
@@ -610,8 +637,47 @@
WEKO_RECORDS_UI_DISPLAY_EXPORT_BOX_FLG = True
""" Display Export box on item detail. """
-WEKO_RECORDS_UI_DISPLAY_RESOURCE_TYPE = False
+WEKO_RECORDS_UI_DISPLAY_RESOURCE_TYPE = False
""" Display resource type on item detail. """
WEKO_RECORDS_UI_DISPLAY_ITEM_TYPE = True
""" Display item type name on item detail. """
+
+WEKO_RECORDS_UI_REST_ENDPOINTS = {
+ 'need_restricted_access': {
+ 'route': '//records//need-restricted-access',
+ 'default_media_type': 'application/json',
+ },
+ 'get_file_terms': {
+ 'route': '//records//files//terms',
+ 'default_media_type': 'application/json',
+ },
+ 'file_application': {
+ 'route': '//records//files//application',
+ 'default_media_type': 'application/json',
+ },
+ 'send_request_mail': {
+ 'route': '//records//request-mail',
+ 'default_media_type': 'application/json',
+ },
+ 'get_captcha_image': {
+ 'route': '//captcha/image',
+ 'default_media_type': 'application/json',
+ },
+ 'validate_captcha_answer': {
+ 'route': '//captcha/validate',
+ 'default_media_type': 'application/json',
+ },
+}
+
+WEKO_RECORDS_UI_API_LIMIT_RATE_DEFAULT = ['100 per minute']
+
+WEKO_RECORDS_UI_API_ACCEPT_LANGUAGES = ['en', 'ja']
+
+WEKO_RECORDS_UI_CAPTCHA_EXPIRATION_SECONDS = 900
+
+WEKO_RECORDS_UI_CAPTCHA_TTL_SECONDS = 600
+
+WEKO_RECORDS_UI_NOTIFICATION_MESSAGE = "以下の内容のリクエストメールをデータ提供者に送信しました。\n\n-----------------------------------------------------------------------------\n\n"
+
+WEKO_RECORDS_UI_REQUEST_MESSAGE = "様からリクエストメールが送信されました。\n\n-----------------------------------------------------------------------------\n\n"
\ No newline at end of file
diff --git a/modules/weko-records-ui/weko_records_ui/errors.py b/modules/weko-records-ui/weko_records_ui/errors.py
new file mode 100644
index 0000000000..ffb0c3a185
--- /dev/null
+++ b/modules/weko-records-ui/weko_records_ui/errors.py
@@ -0,0 +1,95 @@
+# -*- coding: utf-8 -*-
+#
+# This file is part of Invenio.
+# Copyright (C) 2016 CERN.
+#
+# Invenio is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# Invenio is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Invenio; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307, USA.
+#
+# In applying this license, CERN does not
+# waive the privileges and immunities granted to it by virtue of its status
+# as an Intergovernmental Organization or submit itself to any jurisdiction.
+
+"""Index errors."""
+from flask_babelex import gettext as _
+from flask_babelex import get_locale
+from invenio_rest.errors import RESTException, RESTValidationError
+
+
+class VersionNotFoundRESTError(RESTException):
+ """API Version error."""
+
+ code = 400
+ description = _('This API version does not found.')
+
+class InvalidEmailError(RESTException):
+ """Invalid email Error error."""
+
+ code = 400
+ description = _('Invalid mailaddress.')
+
+class InvalidTokenError(RESTException):
+ """Invalid Token Error error."""
+
+ code = 400
+ description = _('Invalid Tokens.')
+
+class RequiredItemNotExistError(RESTValidationError):
+ """Required Item not exists in request body error."""
+
+ description = _('Reqired item does not exist.')
+
+class InvalidCaptchaError(RESTException):
+ """Invalid CAPTCHA calculation result error."""
+
+ code = 400
+ description = _('The calculation results are different.')
+
+class AuthenticationRequiredError(RESTException):
+ """Contents not found error."""
+
+ code = 401
+ description = _('Unauthorized.')
+
+class InvalidWorkflowError(RESTException):
+ """Contents not found error."""
+
+ def __init__(self, errors=None, **kwargs):
+ """Initialize RESTException."""
+ super(InvalidWorkflowError, self).__init__(errors, **kwargs)
+
+ self.code = 403
+ self.description = self.get_this_message()
+
+ def get_this_message(self):
+ from weko_admin.utils import get_restricted_access
+
+ locale = get_locale()
+ restricted_error_msg = get_restricted_access('error_msg')
+ if locale.get_language_name('en') == 'Japanese':
+ return restricted_error_msg['content']['ja']['content']
+ return restricted_error_msg['content']['en']['content']
+
+class ContentsNotFoundError(RESTException):
+ """Contents not found error."""
+
+ code = 404
+ description = _('Contents not found.')
+
+class InternalServerError(RESTException):
+ """Internal Server Error."""
+
+ code = 500
+ description = _('Internal Server Error.')
\ No newline at end of file
diff --git a/modules/weko-records-ui/weko_records_ui/ext.py b/modules/weko-records-ui/weko_records_ui/ext.py
index 3d8c80f06b..7f2c900442 100644
--- a/modules/weko-records-ui/weko_records_ui/ext.py
+++ b/modules/weko-records-ui/weko_records_ui/ext.py
@@ -21,8 +21,9 @@
"""Flask extension for weko-records-ui."""
from . import config
-from .rest import create_blueprint
+from .rest import create_blueprint, create_blueprint_cites
from .views import blueprint
+from weko_admin import config as admin_config
class WekoRecordsUI(object):
@@ -65,6 +66,45 @@ def init_config(self, app):
getattr(config, 'EMAIL_DISPLAY_FLG'))
+class WekoRecordsREST(object):
+ """weko-record-ui-rest extension."""
+
+ def __init__(self, app=None):
+ """Extension initialization.
+
+ :param app: An instance of :class:`flask.Flask`.
+ """
+ if app:
+ self.init_app(app)
+
+ def init_app(self, app):
+ """Flask application initialization.
+
+ Initialize the REST endpoints. Connect all signals if
+ `DEPOSIT_REGISTER_SIGNALS` is True.
+
+ :param app: An instance of :class:`flask.Flask`.
+ """
+ self.init_config(app)
+ blueprint = create_blueprint(
+ app.config['WEKO_RECORDS_UI_REST_ENDPOINTS']
+ )
+ app.register_blueprint(blueprint)
+ app.extensions['weko-records-ui-rest'] = self
+
+ def init_config(self, app):
+ """Initialize configuration.
+
+ :param app: An instance of :class:`flask.Flask`.
+ """
+ for k in dir(config):
+ if k.startswith('WEKO_RECORDS_UI_'):
+ app.config.setdefault(k, getattr(config, k))
+ for k in dir(admin_config):
+ if k.startswith('WEKO_ADMIN_'):
+ app.config.setdefault(k, getattr(admin_config, k))
+
+
class WekoRecordsCitesREST(object):
"""weko-record-ui-rest extension."""
@@ -85,7 +125,7 @@ def init_app(self, app):
:param app: An instance of :class:`flask.Flask`.
"""
self.init_config(app)
- blueprint = create_blueprint(
+ blueprint = create_blueprint_cites(
app.config['WEKO_RECORDS_UI_CITES_REST_ENDPOINTS']
)
app.register_blueprint(blueprint)
diff --git a/modules/weko-records-ui/weko_records_ui/fd.py b/modules/weko-records-ui/weko_records_ui/fd.py
index b59bc0de9e..ee19c9c437 100644
--- a/modules/weko-records-ui/weko_records_ui/fd.py
+++ b/modules/weko-records-ui/weko_records_ui/fd.py
@@ -20,12 +20,15 @@
"""Utilities for download file."""
+import json
import mimetypes
+import traceback
import unicodedata
-from flask import abort, current_app, render_template, request
+from flask import abort, current_app, render_template, request ,redirect ,url_for
from flask_babelex import gettext as _
from flask_login import current_user
+from flask_security.utils import hash_password
from invenio_db import db
from invenio_files_rest import signals
from invenio_files_rest.models import FileInstance
@@ -34,23 +37,25 @@
from requests.sessions import session
from sqlalchemy.exc import SQLAlchemyError
from weko_accounts.views import _redirect_method
+from weko_admin.models import AdminSettings
from weko_deposit.api import WekoRecord
from weko_groups.api import Group
from weko_records.api import FilesMetadata, ItemTypes
+from weko_records_ui.utils import generate_one_time_download_url
from weko_user_profiles.models import UserProfile
+from weko_workflow.utils import is_terms_of_use_only
from werkzeug.datastructures import Headers
from werkzeug.urls import url_quote
-from .models import PDFCoverPageSettings
+from .models import FileOnetimeDownload, FileSecretDownload, PDFCoverPageSettings
from .pdf import make_combined_pdf
from .permissions import check_original_pdf_download_permission, \
- file_permission_factory
-from .utils import check_and_create_usage_report, \
- check_and_send_usage_report, get_billing_file_download_permission, \
+ file_permission_factory, is_owners_or_superusers
+from .utils import check_and_send_usage_report, get_billing_file_download_permission, \
get_groups_price, get_min_price_billing_file_download, \
- get_onetime_download, is_billing_item, parse_one_time_download_token, \
- update_onetime_download, validate_download_record, \
- validate_onetime_download_token
+ get_onetime_download, get_secret_download, is_billing_item, parse_one_time_download_token, parse_secret_download_token, \
+ update_onetime_download, update_secret_download, validate_download_record, \
+ validate_onetime_download_token, validate_secret_download_token
def weko_view_method(pid, record, template=None, **kwargs):
@@ -222,24 +227,29 @@ def file_ui(
obj = fileobj.obj
# Check file contents permission
+ is_terms_of_use_only = _is_terms_of_use_only(fileobj,request.args)
if not file_permission_factory(record, fjson=fileobj).can():
- if not current_user.is_authenticated:
- return _redirect_method(has_next=True)
- abort(403)
+ # [利用規約のみ]の場合、アクセス権無しでもファイルダウンロード可能。
+ if not is_terms_of_use_only:
+ if not current_user.is_authenticated:
+ return _redirect_method(has_next=True)
+ abort(403)
- # Check and create usage report
if not is_preview:
- try:
- check_and_create_usage_report(record, fileobj)
- db.session.commit()
- except SQLAlchemyError as ex:
- current_app.logger.error("sqlalchemy error: {}".format(ex))
- db.session.rollback()
- abort(500)
- except BaseException as ex:
- current_app.logger.error("Unexpected error: {}".format(ex))
- db.session.rollback()
- abort(500)
+ # open_restricted download
+ if 'open_restricted' in fileobj.get('accessrole', '') \
+ and not is_terms_of_use_only \
+ and not is_owners_or_superusers(record):
+
+ file_name = fileobj["filename"]
+ record_id = pid.pid_value
+ user_mail = current_user.email
+ onetime_download :FileOnetimeDownload = get_onetime_download(file_name ,record_id,user_mail)
+ if onetime_download is None:
+ current_app.logger.info('onetime_download is None')
+ abort(403)
+
+ return file_download_onetime(pid=pid, record=record, file_name=file_name, user_mail=user_mail, login_flag=True) #call by method
# #Check permissions
# ObjectResource.check_object_permission(obj)
@@ -397,77 +407,210 @@ def add_signals_info(record, obj):
obj.item_id = record['_deposit']['id']
-def file_download_onetime(pid, record, _record_file_factory=None, **kwargs):
+def file_download_onetime(pid, record,file_name=None, user_mail=None,login_flag=False, _record_file_factory=None, **kwargs):
"""File download onetime.
-
+
:param pid:
:param record: Record json
:param _record_file_factory:
:param kwargs:
:return:
"""
- token = request.args.get('token', type=str)
- filename = kwargs.get("filename")
- error_template = "weko_theme/error.html"
- # Parse token
- error, token_data = \
- parse_one_time_download_token(token)
- if error:
- return render_template(error_template, error=error)
- record_id, user_mail, date, secret_token = token_data
-
+ def __make_error_response(is_ajax, error_msg):
+ error_template = "weko_theme/error.html"
+ if is_ajax:
+ return error_msg, 401
+ else:
+ return render_template(error_template,
+ error=error_msg)
+
+ # Cutting out the necessary information
+ if login_flag: #call by method, for login user
+ filename = file_name
+ user_mail = user_mail
+ record_id = pid.pid_value
+ else: #call by redirect, for guest
+ is_ajax = request.args.get('isajax')
+ filename = kwargs.get("filename")
+ token = request.args.get('token', type=str)
+ mailaddress = request.args.get('mailaddress',None)
+ input_password = ""
+ if request.method == "POST":
+ input_pwd = request.get_json().get('input_password')
+ if input_pwd:
+ input_password = hash_password(input_pwd)
+ # Parse token
+ if not mailaddress:
+ onetime_file_url = request.url
+ url=url_for(endpoint="invenio_records_ui.recid", onetime_file_url= onetime_file_url, pid_value = pid.pid_value, v="mailcheckflag")
+ return redirect(url)
+ error, token_data = \
+ parse_one_time_download_token(token)
+ if error:
+ return __make_error_response(is_ajax, error_msg=error)
+ record_id, user_mail, date, secret_token = token_data
+
# Validate record status
validate_download_record(record)
-
+
# Get one time download record.
onetime_download = get_onetime_download(
file_name=filename, record_id=record_id, user_mail=user_mail
)
-
- # Validate token
- is_valid, error = validate_onetime_download_token(
- onetime_download, filename, record_id, user_mail, date, secret_token)
- if not is_valid:
- return render_template(error_template, error=error)
-
+
+ # # Validate token for guest
+ if not current_user.is_authenticated:
+ is_valid, error = validate_onetime_download_token(
+ onetime_download, filename, record_id, user_mail, date, secret_token)
+ if not is_valid:
+ return __make_error_response(is_ajax, error_msg=error)
+
_record_file_factory = _record_file_factory or record_file_factory
-
+
# Get file object
file_object = _record_file_factory(pid, record, filename)
- if not file_object or not file_object.obj:
- return render_template(error_template,
- error="{} does not exist.".format(filename))
-
+ if not file_object or not file_object.obj :
+ return __make_error_response(is_ajax, error_msg="{} does not exist.".format(filename))
+
# Create updated data
update_data = dict(
file_name=filename, record_id=record_id, user_mail=user_mail,
download_count=onetime_download.download_count - 1,
)
-
+
# Check and send usage report for Guest User.
if onetime_download.extra_info and 'open_restricted' == file_object.get(
'accessrole'):
extra_info = onetime_download.extra_info
try:
- error_msg = check_and_send_usage_report(extra_info, user_mail)
+ error_msg = check_and_send_usage_report(extra_info, user_mail ,record, file_object)
if error_msg:
- return render_template(error_template, error=error_msg)
+ return __make_error_response(is_ajax, error_msg=error_msg)
db.session.commit()
except SQLAlchemyError as ex:
current_app.logger.error("sqlalchemy error: {}".format(ex))
db.session.rollback()
- return render_template(error_template, error=_("Unexpected error occurred."))
+ return __make_error_response(is_ajax, error_msg=_("Unexpected error occurred."))
except BaseException as ex:
current_app.logger.error("Unexpected error: {}".format(ex))
db.session.rollback()
- return render_template(error_template, error=_("Unexpected error occurred."))
-
+ return __make_error_response(is_ajax, error_msg=_("Unexpected error occurred."))
+
update_data['extra_info'] = extra_info
-
+
# Update download data
if not update_onetime_download(**update_data):
- return render_template(error_template,
- error=_("Unexpected error occurred."))
-
+ return __make_error_response(is_ajax, error_msg=_("Unexpected error occurred."))
+
+ passcheck_function = True
+ restricted_access = AdminSettings.get(name='restricted_access',dict_to_object=False)
+ password_for_download = onetime_download.extra_info.get("password_for_download", "")
+ if restricted_access and restricted_access.get('password_enable', False):
+ if password_for_download and input_password != password_for_download:
+ passcheck_function = False
+
+ # Guest Mailaddress Check
+ if not current_user.is_authenticated:
+ if mailaddress == user_mail and passcheck_function:
+ return _download_file(file_object, False, 'en', file_object.obj, pid,
+ record)
+ else:
+ return __make_error_response(is_ajax, error_msg=_("Could not download file."))
+
return _download_file(file_object, False, 'en', file_object.obj, pid,
record)
+
+def _is_terms_of_use_only(file_obj:dict , req :dict) -> bool:
+ """
+ return true if the user can apply and apply workflow is terms_of_use_only
+ in case of terms_of_use_only download terms of use is agreed (or terms of use is not setted)
+ Args
+ dict:file_obj :file object
+ dict:req :request.args
+ Returns
+ bool
+ """
+
+ consent:bool = req.get('terms_of_use_only',False)
+ if not consent :
+ return False
+
+ provides = file_obj.get("provide" , [])
+ workflow_id = ""
+ for provide in provides :
+ if current_user.is_authenticated :
+ roles = list(current_user.roles or [])
+ for role in roles :
+ if provide.get("role", "") == str(role.id) :
+ workflow_id = provide.get("workflow", "")
+ break
+ else :
+ if provide.get("role", "") == "none_loggin" :
+ workflow_id = provide.get("workflow", "")
+
+ if workflow_id != "" :
+ break
+
+ return is_terms_of_use_only(workflow_id) if workflow_id != "" else False
+
+def file_download_secret(pid, record, _record_file_factory=None, **kwargs):
+ """File download secret.
+
+ :param pid:
+ :param record: Record json
+ :param _record_file_factory:
+ :param kwargs:
+ :return:
+ """
+ token = request.args.get('token', type=str)
+ filename:str = str(kwargs.get("filename"))
+ error_template = "weko_theme/error.html"
+ # Parse token
+ error, token_data = \
+ parse_secret_download_token(token)
+ if error:
+ return render_template(error_template, error=error)
+ record_id, id, date, secret_token = token_data
+
+ # Validate record status
+ validate_download_record(record)
+
+ # Get secret download record.
+ secret_download :FileSecretDownload = get_secret_download(
+ file_name=filename, record_id=pid.pid_value, id=id , created=date
+ )
+
+ if not secret_download:
+ abort(403)
+
+ # Validate token
+ is_valid, error = validate_secret_download_token(
+ secret_download, filename, pid.pid_value, id, secret_download.created, secret_token)
+ if not is_valid:
+ return render_template(error_template, error=error)
+ _record_file_factory = _record_file_factory or record_file_factory
+
+ # Get file object
+ file_object = _record_file_factory(pid, record, filename)
+ if not file_object or not file_object.obj:
+ return render_template(error_template,
+ error="{} does not exist.".format(filename))
+
+ # Create updated data
+ update_data = dict(
+ file_name=filename, record_id=record_id, id=id, created=date,
+ download_count=secret_download.download_count - 1
+ )
+
+ # Update download data
+ if not update_secret_download(**update_data):
+ return render_template(error_template,
+ error=_("Unexpected error occurred."))
+
+ # Get user's language and defautl language for PDF coverpage.
+ lang = 'en'
+ if current_user.is_authenticated :
+ user_profile = UserProfile.get_by_userid(current_user.get_id())
+ lang = user_profile.language if user_profile and user_profile.language \
+ else 'en'
+ return _download_file(file_object, False, lang, file_object.obj, pid, record)
\ No newline at end of file
diff --git a/modules/weko-records-ui/weko_records_ui/models.py b/modules/weko-records-ui/weko_records_ui/models.py
index be767665b7..7c288186ed 100644
--- a/modules/weko-records-ui/weko_records_ui/models.py
+++ b/modules/weko-records-ui/weko_records_ui/models.py
@@ -22,11 +22,16 @@
"""Database models for weko-admin."""
from datetime import datetime
+from datetime import timedelta
+import traceback
+from typing import List
from flask import current_app
from invenio_db import db
-from sqlalchemy import desc, or_
+from sqlalchemy import desc, or_ ,func
from sqlalchemy.dialects import postgresql
+from sqlalchemy.dialects.postgresql import INTERVAL
+from sqlalchemy.sql.functions import concat ,now
from sqlalchemy_utils.models import Timestamp
from sqlalchemy_utils.types import JSONType
@@ -216,19 +221,23 @@ def find(cls, user_id, record_id, file_name):
return permission
@classmethod
- def find_list_permission_by_date(cls, user_id, record_id, file_name,
- duration):
- """Find user 's permission by date."""
- list_permission = db.session.query(cls) \
+ def find_list_permission_approved(cls, user_id:int, record_id:str, file_name:str):
+ """Find user 's approved permission
+ Args
+ int:user_id
+ str:record_id
+ str:file_name
+ Returns
+ List[FilePermission]
+
+ """
+ list_permission:List[FilePermission] = db.session.query(cls) \
.filter(
- or_(
- cls.open_date >= duration,
- cls.open_date.is_(None),
- )
+ cls.status == 1 # Approval
) \
.filter_by(user_id=user_id,
- record_id=record_id,
- file_name=file_name).order_by(
+ record_id=record_id,
+ file_name=file_name).order_by(
desc(cls.id)).all()
return list_permission
@@ -263,10 +272,9 @@ def update_open_date(cls, permission, open_date):
@classmethod
def find_by_activity(cls, activity_id):
"""Find user 's permission activity id."""
- permission = db.session.query(cls).filter_by(
- usage_application_activity_id=activity_id) \
- .first()
- return permission
+ permissions = db.session.query(cls).filter_by(
+ usage_application_activity_id=activity_id).order_by(desc(cls.id)).all()
+ return permissions
@classmethod
def update_usage_report_activity_id(cls, permission, activity_id):
@@ -399,6 +407,118 @@ def find(cls, **obj) -> list:
cls.user_mail == obj.get("user_mail"),
)
return query.order_by(desc(cls.id)).all()
+
+ @classmethod
+ def find_downloadable_only(cls, **obj) -> list:
+ """If the user can download ,find file onetime download.
+
+ :param obj:
+ :return:
+ """
+ query = db.session.query(cls).filter(
+ cls.file_name == obj.get("file_name"),
+ cls.record_id == obj.get("record_id"),
+ cls.user_mail == obj.get("user_mail"),
+ cls.download_count > 0 ,
+ now() < cls.created + func.cast( concat( cls.expiration_date , ' days' ) , INTERVAL)
+ )
+ return query.order_by(desc(cls.id)).all()
+
+
+class FileSecretDownload(db.Model, Timestamp):
+ """File secret download."""
+
+ __tablename__ = 'file_secret_download'
+
+ id = db.Column(db.Integer, primary_key=True, autoincrement=True)
+ """Identifier"""
+
+ file_name = db.Column(db.String(255), nullable=False)
+ """File name"""
+
+ user_mail = db.Column(db.String(255), nullable=False)
+ """User mail"""
+
+ record_id = db.Column(db.String(255), nullable=False)
+ """Record identifier."""
+
+ download_count = db.Column(db.Integer, nullable=False, default=0)
+ """Download count"""
+
+ expiration_date = db.Column(db.Integer, nullable=False, default=0)
+ """Expiration Date"""
+
+ def __init__(self, file_name, user_mail, record_id, download_count=0,
+ expiration_date=0):
+ """Init.
+
+ :param file_name: File name
+ :param user_mail: User mail
+ :param record_id: Record identifier
+ :param download_count: Download count
+ :param expiration_date: Expiration date
+ """
+ self.file_name = file_name
+ self.user_mail = user_mail
+ self.record_id = record_id
+ self.download_count = download_count
+ self.expiration_date = expiration_date
+
+ @classmethod
+ def create(cls, **data):
+ """Create data."""
+ try:
+ file_download = cls(**data)
+ db.session.add(file_download)
+ db.session.commit()
+ db.session.flush()
+ return file_download
+ except Exception as ex:
+ db.session.rollback()
+ current_app.logger.error(ex)
+ raise ex
+
+ @classmethod
+ def update_download(cls, **data):
+ """Update download count.
+
+ :param data:
+ :return:
+ """
+ try:
+ file_name = data.get("file_name")
+ id = data.get("id")
+ record_id = data.get("record_id")
+ created = data.get("created")
+ file_permission = cls.find(file_name=file_name, id=id,
+ record_id=record_id ,created=created)
+ if len(file_permission) == 1:
+ file = file_permission[0]
+ if data.get("download_count") is not None:
+ file.download_count = data.get("download_count")
+ db.session.merge(file)
+ db.session.commit()
+ return file_permission
+ else:
+ return None
+ except Exception as ex:
+ db.session.rollback()
+ current_app.logger.error(traceback.format_exc())
+ raise ex
+
+ @classmethod
+ def find(cls, **obj) -> list:
+ """Find file onetime download.
+ :param obj:
+ :return:
+ """
+ query = db.session.query(cls).filter(
+ cls.id == obj.get("id"),
+ cls.file_name == obj.get("file_name"),
+ cls.record_id == obj.get("record_id"),
+ cls.created == obj.get("created")
+ )
+ return query.order_by(desc(cls.id)).all()
-__all__ = ('PDFCoverPageSettings', 'FilePermission', 'FileOnetimeDownload')
+__all__ = ('PDFCoverPageSettings', 'FilePermission', 'FileOnetimeDownload' ,'FileSecretDownload')
diff --git a/modules/weko-records-ui/weko_records_ui/permissions.py b/modules/weko-records-ui/weko_records_ui/permissions.py
index 4eae7b50fd..b68247b407 100644
--- a/modules/weko-records-ui/weko_records_ui/permissions.py
+++ b/modules/weko-records-ui/weko_records_ui/permissions.py
@@ -22,6 +22,8 @@
from datetime import datetime as dt
from datetime import timedelta, timezone
+import traceback
+from typing import List, Optional
from flask import abort, current_app
from flask_babelex import get_locale, to_user_timezone, to_utc
@@ -133,8 +135,8 @@ def __check_user_permission(user_id_list):
# Get email list of created workflow user.
user_id_list = [int(record['owner'])] if record.get('owner') else []
- if record.get('weko_shared_id'):
- user_id_list.append(record.get('weko_shared_id'))
+ if record.get('weko_shared_ids'):
+ user_id_list.extend(record.get('weko_shared_ids'))
created_user_email_list = get_email_list_by_ids(user_id_list)
# Registered user
@@ -172,11 +174,51 @@ def __check_user_permission(user_id_list):
is_can = True
else:
try:
- date = fjson.get('date')
+ # contents accessdate
+ date = fjson.get('accessdate',None)
+ if not date:
+ date = fjson.get('date')
if date and isinstance(date, list) and date[0]:
adt = date[0].get('dateValue')
- pdt = to_utc(dt.strptime(adt, '%Y-%m-%d'))
- is_can = True if dt.utcnow() >= pdt else False
+ if adt:
+ adt = to_utc(dt.strptime(adt, '%Y-%m-%d'))
+ c_is_can = True if dt.utcnow() >= adt else False
+ # publish date
+ p_is_can = True
+ idt = record.get('publish_date')
+ if idt:
+ idt = to_utc(dt.strptime(idt, '%Y-%m-%d'))
+ p_is_can = True if dt.utcnow() >= idt else False
+
+ # roles check
+ role_is_can = False
+ roles = fjson.get('roles')
+ if c_is_can and p_is_can:
+ role_is_can = True
+ elif roles and isinstance(roles, list) and len(roles)>0:
+ for lst in list(current_user.roles or []):
+ for role_value in [ role.get('role') for role in roles ]:
+ if __isint(role_value):
+ if lst.id == int(role_value):
+ role_is_can = True
+ if role_is_can:
+ c_is_can = True
+ break
+ else:
+ if lst.name == role_value:
+ role_is_can = True
+ if role_is_can:
+ c_is_can = True
+ break
+ # ログインユーザーに権限なしの場合でも、コンテンツで「非ログインユーザー」指定した場合OK
+ # if len(list(current_user.roles))==0:
+ # if 'none_loggin' in [ role.get('role') for role in roles ]:
+ # role_is_can = True
+ else:
+ role_is_can = True
+
+ is_can = c_is_can and p_is_can and role_is_can
+
except BaseException:
is_can = False
@@ -190,34 +232,52 @@ def __check_user_permission(user_id_list):
# Always display the file info area in 'Detail' screen.
is_can = True
else:
- is_can = False
- users = current_app.config['WEKO_PERMISSION_ROLE_USER']
- for lst in list(current_user.roles or []):
- if lst.name in users:
- is_can = True
- break
+ # ログインユーザーか
+ is_login_user = current_user.is_authenticated
+
+ # rolesで指定されたユーザーロールか
+ is_role_can = False
+ roles = fjson.get('roles')
+ if roles and isinstance(roles, list) and len(roles)>0:
+ for lst in list(current_user.roles or []):
+ for role_value in [ role.get('role') for role in roles ]:
+ if __isint(role_value):
+ if lst.id == int(role_value):
+ is_role_can = True
+ break
+ else:
+ if lst.name == role_value:
+ is_role_can = True
+ break
+ # ログインユーザーに権限なしの場合でも、コンテンツで「非ログインユーザー」指定した場合OK
+ # if 'none_loggin' in [ role.get('role') for role in roles ]:
+ # is_role_can = True
+
+ else:
+ is_role_can = True
# Billing file permission check
+ is_billing_can = False
if fjson.get('groupsprice'):
is_user_group_permission = False
groups = fjson.get('groupsprice')
for group in list(groups or []):
group_id = group.get('group')
if check_user_group_permission(group_id):
- is_user_group_permission = \
- check_user_group_permission(group_id)
+ is_user_group_permission = check_user_group_permission(group_id)
break
- is_can = is_can & is_user_group_permission
+ is_billing_can = is_user_group_permission
else:
if current_user.is_authenticated:
if fjson.get('groups'):
- is_can = check_user_group_permission(
- fjson.get('groups'))
+ is_billing_can = check_user_group_permission(fjson.get('groups'))
else:
- is_can = True
- if not is_can:
+ is_billing_can = True
+ if not is_billing_can:
# site license permission check
- is_can = site_license_check()
+ is_billing_can = site_license_check()
+
+ is_can = is_login_user and is_role_can and is_billing_can
# can not access
elif 'open_no' in acsrole:
@@ -267,41 +327,50 @@ def is_open_restricted(file_data):
result = True
return result
+def check_content_clickable(record:dict, fjson:dict) -> bool:
+ """Check if content file is Applyable.
+ Args
+ record: the records metadata
+ fjson: file object json
-def check_content_clickable(record, fjson):
- """Check if content file is clickable."""
+ Returns
+ bool: is content Applyable
+ """
if not is_open_restricted(fjson):
return False
- record_id = record.get('recid')
- file_name = fjson.get('filename')
- list_permission = __get_file_permission(record_id, file_name)
- # can click if user have not log in
- if list_permission:
- permission = list_permission[0]
- if permission.status == 0:
- return False
- else:
- return True
- else:
- return True
+ return not check_open_restricted_permission(record, fjson)
+
+def check_permission_period(permission : FilePermission) -> bool :
+ """Check download permission.
+ Args
+ FilePermission:permission
+ Returns
+ bool:is the user has access rights or not
+ """
+
+ from weko_records_ui.utils import get_valid_onetime_download
+ from weko_items_ui.utils import get_user_information
-def check_permission_period(permission):
- """Check download permission."""
if permission.status == 1:
- return True
+ res = get_valid_onetime_download(permission.file_name ,permission.record_id , get_user_information(permission.user_id)[0]['email'])
+ current_app.logger.info(res)
+ return res is not None
else:
return False
-def get_permission(record, fjson):
+def get_permission(record:dict, fjson:dict) -> Optional[FilePermission]:
"""Get download file permission.
-
- @param record:
- @param fjson:
- @return:
+ Args
+ record: the records metadata
+ fjson: file object json
+ Returns
+ FilePermission or None
"""
# current_app.logger.debug("fjson: {}".format(fjson))
+ if not check_file_download_permission(record, fjson):
+ return None
record_id = record.get('recid')
file_name = fjson.get('filename')
list_permission = __get_file_permission(record_id, file_name)
@@ -425,10 +494,10 @@ def check_publish_status(record):
# break
# if lst.name == users[2]:
# is_himself = False
-# shared_id = record.get('weko_shared_id')
+# shared_ids = record.get('weko_shared_ids')
# if user_id and created_id and user_id == str(created_id):
# is_himself = True
-# elif user_id and shared_id and user_id == str(shared_id):
+# elif user_id and shared_ids and str(user_id) in shared_ids:
# is_himself = True
# elif lst.name == users[3]:
# is_himself = False
@@ -439,7 +508,7 @@ def check_created_id(record):
Args:
record (dict): the record to check edit permission.
- example: {'_oai': {'id': 'oai:weko3.example.org:00000001', 'sets': ['1657555088462']}, 'path': ['1657555088462'], 'owner': '1', 'recid': '1', 'title': ['a'], 'pubdate': {'attribute_name': 'PubDate', 'attribute_value': '2022-07-12'}, '_buckets': {'deposit': '35004d51-8938-4e77-87d7-0c9e176b8e7b'}, '_deposit': {'id': '1', 'pid': {'type': 'depid', 'value': '1', 'revision_id': 0}, 'owner': '1', 'owners': [1], 'status': 'published', 'created_by': 1, 'owners_ext': {'email': 'wekosoftware@nii.ac.jp', 'username': '', 'displayname': ''}}, 'item_title': 'a', 'author_link': [], 'item_type_id': '15', 'publish_date': '2022-07-12', 'publish_status': '0', 'weko_shared_id': -1, 'item_1617186331708': {'attribute_name': 'Title', 'attribute_value_mlt': [{'subitem_1551255647225': 'a', 'subitem_1551255648112': 'ja'}]}, 'item_1617258105262': {'attribute_name': 'Resource Type', 'attribute_value_mlt': [{'resourceuri': 'http://purl.org/coar/resource_type/c_5794', 'resourcetype': 'conference paper'}]}, 'relation_version_is_last': True}
+ example: {'_oai': {'id': 'oai:weko3.example.org:00000001', 'sets': ['1657555088462']}, 'path': ['1657555088462'], 'owner': '1', 'recid': '1', 'title': ['a'], 'pubdate': {'attribute_name': 'PubDate', 'attribute_value': '2022-07-12'}, '_buckets': {'deposit': '35004d51-8938-4e77-87d7-0c9e176b8e7b'}, '_deposit': {'id': '1', 'pid': {'type': 'depid', 'value': '1', 'revision_id': 0}, 'owner': '1', 'owners': [1], 'status': 'published', 'created_by': 1, 'owners_ext': {'email': 'wekosoftware@nii.ac.jp', 'username': '', 'displayname': ''}}, 'item_title': 'a', 'author_link': [], 'item_type_id': '15', 'publish_date': '2022-07-12', 'publish_status': '0', 'weko_shared_ids': [], 'item_1617186331708': {'attribute_name': 'Title', 'attribute_value_mlt': [{'subitem_1551255647225': 'a', 'subitem_1551255648112': 'ja'}]}, 'item_1617258105262': {'attribute_name': 'Resource Type', 'attribute_value_mlt': [{'resourceuri': 'http://purl.org/coar/resource_type/c_5794', 'resourcetype': 'conference paper'}]}, 'relation_version_is_last': True}
Returns:
bool: True is the current user has the edit permission.
@@ -449,12 +518,12 @@ def check_created_id(record):
supers = current_app.config['WEKO_PERMISSION_SUPER_ROLE_USER']
user_id = current_user.get_id() \
if current_user and current_user.is_authenticated else None
- if user_id is not None:
+ if user_id is not None:
created_id = record.get('_deposit', {}).get('created_by')
- shared_id = record.get('weko_shared_id')
+ shared_ids = record.get('weko_shared_ids')
if user_id and created_id and user_id == str(created_id):
is_himself = True
- elif user_id and shared_id and user_id == str(shared_id):
+ elif user_id and len(shared_ids)>0 and int(user_id) in shared_ids:
is_himself = True
for lst in list(current_user.roles or []):
# In case of supper user,it's always have permission
@@ -471,7 +540,7 @@ def check_usage_report_in_permission(permission):
return False
-def check_create_usage_report(record, file_json):
+def check_create_usage_report(record, file_json , user_id=None):
"""Check create usage report.
@param record:
@@ -480,21 +549,60 @@ def check_create_usage_report(record, file_json):
"""
record_id = record.get('recid')
file_name = file_json.get('filename')
- list_permission = __get_file_permission(record_id, file_name)
- if list_permission:
- permission = list_permission[0]
+ list_permission = __get_file_permission(record_id, file_name ,user_id)
+ for permission in list_permission:
if check_usage_report_in_permission(permission):
return permission
- else:
- return None
+ return None
+def is_owners_or_superusers(record) -> bool:
+ """
+ return true if the user can download the record's contents unconditionally
-def __get_file_permission(record_id, file_name):
- """Get file permission."""
- user_id = current_user.get_id()
- current_time = dt.now()
- duration = current_time - timedelta(
- days=current_app.config['WEKO_RECORDS_UI_DOWNLOAD_DAYS'])
- list_permission = FilePermission.find_list_permission_by_date(
- user_id, record_id, file_name, duration)
+ Args
+ record: The record metadata.
+
+ Returns
+ bool: is owners or superusers
+ """
+ # Get email list of created workflow user.
+ user_id_list = [int(record['owner'])] if record.get('owner') else []
+ if record.get('weko_shared_ids'):
+ user_id_list.extend(record.get('weko_shared_ids'))
+
+ # Registered user
+ if current_user and \
+ current_user.is_authenticated and \
+ current_user.id in user_id_list:
+ return True
+
+ # Super users
+ supers = current_app.config['WEKO_PERMISSION_SUPER_ROLE_USER'] + \
+ current_app.config['WEKO_PERMISSION_ROLE_COMMUNITY']
+ for role in list(current_user.roles or []):
+ if role.name in supers:
+ return True
+
+ return False
+
+
+def __get_file_permission(record_id:str, file_name:str ,user_id = None) -> List[FilePermission]:
+ """Get file permission.
+ Args
+ str:record_id
+ str:file_name
+ Returns
+ List[FilePermission]
+ """
+ user_id = user_id or current_user.get_id()
+ list_permission = FilePermission.find_list_permission_approved(
+ user_id, record_id, file_name)
return list_permission
+
+def __isint(str):
+ try:
+ int(str, 10)
+ except ValueError:
+ return False
+ else:
+ return True
\ No newline at end of file
diff --git a/modules/weko-records-ui/weko_records_ui/rest.py b/modules/weko-records-ui/weko_records_ui/rest.py
index fce9685264..782696f1b4 100644
--- a/modules/weko-records-ui/weko_records_ui/rest.py
+++ b/modules/weko-records-ui/weko_records_ui/rest.py
@@ -20,8 +20,21 @@
"""Blueprint for schema rest."""
-from flask import Blueprint, current_app, jsonify, make_response, request
-from invenio_pidstore.errors import PIDInvalidAction
+import inspect
+
+from email_validator import validate_email
+from flask import Flask, Blueprint, current_app, jsonify, make_response, request, abort, url_for
+from flask_babelex import get_locale
+from flask_babelex import gettext as _
+from flask_limiter import Limiter
+from flask_limiter.util import get_remote_address
+from flask_login import current_user
+from urllib import parse
+from redis import RedisError
+from invenio_db import db
+from invenio_oauth2server import require_api_auth, require_oauth_scopes
+from invenio_pidrelations.contrib.versioning import PIDVersioning
+from invenio_pidstore.errors import PIDInvalidAction, PIDDoesNotExistError
from invenio_pidstore.models import PersistentIdentifier
from invenio_records_rest.links import default_links_factory
from invenio_records_rest.utils import obj_or_import_string
@@ -29,10 +42,23 @@
create_error_handlers as records_rest_error_handlers
from invenio_rest import ContentNegotiatedMethodView
from invenio_rest.views import create_api_errorhandler
+from sqlalchemy.exc import SQLAlchemyError
from weko_deposit.api import WekoRecord
+from weko_records.api import ItemTypes
from weko_records.serializers import citeproc_v1
+from weko_records_ui.api import create_captcha_image, send_request_mail, validate_captcha_answer
+from weko_workflow.api import WorkActivity, WorkFlow
+from weko_workflow.models import GuestActivity
+from weko_workflow.scopes import activity_scope
+from weko_workflow.utils import check_etag, check_pretty, init_activity_for_guest_user
+from werkzeug.http import generate_etag
+
+from .errors import ContentsNotFoundError, InternalServerError, InvalidEmailError, InvalidTokenError, InvalidWorkflowError,RequiredItemNotExistError, VersionNotFoundRESTError
+from .scopes import item_read_scope
+from .utils import create_limmiter
+from .views import escape_str, get_usage_workflow
-from .views import escape_str
+limiter = create_limmiter()
def create_error_handlers(blueprint):
@@ -44,6 +70,95 @@ def create_error_handlers(blueprint):
def create_blueprint(endpoints):
+ """
+ Create Weko-Records-ui-REST blueprint.
+ See: :data:`weko_records_ui.config.WEKO_RECORDS_UI_REST_ENDPOINTS`.
+
+ :param endpoints: List of endpoints configuration.
+ :returns: The configured blueprint.
+ """
+ blueprint = Blueprint(
+ 'weko_records_ui_rest',
+ __name__,
+ url_prefix='',
+ )
+
+ @blueprint.teardown_request
+ def dbsession_clean(exception):
+ current_app.logger.debug("weko_records_ui dbsession_clean: {}".format(exception))
+ if exception is None:
+ try:
+ db.session.commit()
+ except:
+ db.session.rollback()
+ db.session.remove()
+
+ for endpoint, options in (endpoints or {}).items():
+ if endpoint == 'need_restricted_access':
+ view_func = NeedRestrictedAccess.as_view(
+ NeedRestrictedAccess.view_name.format(endpoint),
+ default_media_type=options.get('default_media_type'),
+ )
+ blueprint.add_url_rule(
+ options.get('route'),
+ view_func=view_func,
+ methods=['GET'],
+ )
+ if endpoint == 'get_file_terms':
+ view_func = GetFileTerms.as_view(
+ GetFileTerms.view_name.format(endpoint),
+ default_media_type=options.get('default_media_type'),
+ )
+ blueprint.add_url_rule(
+ options.get('route'),
+ view_func=view_func,
+ methods=['GET'],
+ )
+ if endpoint == 'file_application':
+ view_func = FileApplication.as_view(
+ FileApplication.view_name.format(endpoint),
+ default_media_type=options.get('default_media_type'),
+ )
+ blueprint.add_url_rule(
+ options.get('route'),
+ view_func=view_func,
+ methods=['POST'],
+ )
+ if endpoint == 'send_request_mail':
+ view_func = RequestMail.as_view(
+ RequestMail.view_name.format(endpoint),
+ default_media_type=options.get('default_media_type'),
+ )
+ blueprint.add_url_rule(
+ options.get('route'),
+ view_func=view_func,
+ methods=['POST'],
+ )
+ if endpoint == 'get_captcha_image':
+ view_func = CreateCaptchaImage.as_view(
+ CreateCaptchaImage.view_name.format(endpoint),
+ default_media_type=options.get('default_media_type'),
+ )
+ blueprint.add_url_rule(
+ options.get('route'),
+ view_func=view_func,
+ methods=['GET'],
+ )
+ if endpoint == 'validate_captcha_answer':
+ view_func = CaptchaAnswerValidation.as_view(
+ CaptchaAnswerValidation.view_name.format(endpoint),
+ default_media_type=options.get('default_media_type'),
+ )
+ blueprint.add_url_rule(
+ options.get('route'),
+ view_func=view_func,
+ methods=['POST'],
+ )
+
+ return blueprint
+
+
+def create_blueprint_cites(endpoints):
"""Create Weko-Records-UI-Cites-REST blueprint.
See: :data:`invenio_deposit.config.DEPOSIT_REST_ENDPOINTS`.
@@ -56,7 +171,7 @@ def create_blueprint(endpoints):
__name__,
url_prefix='',
)
-
+
@blueprint.teardown_request
def dbsession_clean(exception):
current_app.logger.debug("weko_records_ui dbsession_clean: {}".format(exception))
@@ -105,7 +220,7 @@ def dbsession_clean(exception):
default_media_type=options.get('default_media_type'),
)
blueprint.add_url_rule(
- options.pop('cites_route'),
+ options.get('cites_route'),
view_func=cites,
methods=['GET'],
)
@@ -113,6 +228,326 @@ def dbsession_clean(exception):
return blueprint
+class NeedRestrictedAccess(ContentNegotiatedMethodView):
+ view_name = 'records_ui_{0}'
+
+ def __init__(self, *args, **kwargs):
+ """Constructor."""
+ super(NeedRestrictedAccess, self).__init__(*args, **kwargs)
+
+ @require_api_auth(True)
+ @require_oauth_scopes(item_read_scope.id)
+ @limiter.limit('')
+ def get(self, **kwargs):
+ """
+ Check if need restricted access.
+
+ Returns:
+ Result for each file.
+ """
+ version = kwargs.get('version')
+ func_name = f'get_{version}'
+ if func_name in [func[0] for func in inspect.getmembers(self, inspect.ismethod)]:
+ return getattr(self, func_name)(**kwargs)
+ else:
+ raise VersionNotFoundRESTError()
+
+ def get_v1(self, **kwargs):
+ # Get record
+ pid_value = kwargs.get('pid_value')
+ record = self.__get_record(pid_value)
+ if record is None:
+ abort(404)
+
+ # Get files
+ from .utils import get_file_info_list
+ _, files = get_file_info_list(record)
+
+ res_json = []
+ for file in files:
+ # Check if file is restricted access.
+ from .permissions import check_file_download_permission, check_content_clickable
+ access_permission = check_file_download_permission(record, file)
+ applicable = check_content_clickable(record, file)
+ need_restricted_access = not access_permission and applicable
+
+ # Create response
+ res_json.append({
+ 'need_restricted_access': need_restricted_access,
+ 'filename': file.get('filename')
+ })
+
+ response = make_response(jsonify(res_json), 200)
+ return response
+
+ def __get_record(self, pid_value):
+ record = None
+ try:
+ pid = PersistentIdentifier.get('recid', pid_value)
+
+ # Get latest PID.
+ from weko_deposit.pidstore import get_record_without_version
+ pid_without_version = get_record_without_version(pid)
+ latest_pid = PIDVersioning(child=pid_without_version).last_child
+
+ # Check if activity is completed.
+ from weko_workflow.api import WorkActivity
+ from weko_workflow.models import ActivityStatusPolicy
+ activity = WorkActivity().get_workflow_activity_by_item_id(latest_pid.object_uuid)
+ if activity.activity_status != ActivityStatusPolicy.ACTIVITY_FINALLY:
+ return None
+
+ # Get record.
+ record = WekoRecord.get_record(pid.object_uuid)
+ except:
+ return None
+
+ return record
+
+class GetFileTerms(ContentNegotiatedMethodView):
+ view_name = 'records_ui_{0}'
+
+ def __init__(self, *args, **kwargs):
+ """Constructor."""
+ super(GetFileTerms, self).__init__(*args, **kwargs)
+
+ @require_api_auth(True)
+ @require_oauth_scopes(activity_scope.id)
+ @limiter.limit('')
+ def get(self, **kwargs):
+ """
+ Get files tarms.
+
+ Returns:
+ tarms text and etag.
+ """
+ version = kwargs.get('version')
+ func_name = f'get_{version}'
+ if func_name in [func[0] for func in inspect.getmembers(self, inspect.ismethod)]:
+ return getattr(self, func_name)(**kwargs)
+ else:
+ raise VersionNotFoundRESTError() # 404 Error
+
+ def get_v1(self, **kwargs):
+ # Get parameter
+ param_pretty = str(request.values.get('pretty', 'false'))
+ language = str(request.headers.get('Accept-Language', 'en'))
+
+ # Check pretty
+ check_pretty(param_pretty)
+
+ # Setting language
+ if language in current_app.config.get('WEKO_RECORDS_UI_API_ACCEPT_LANGUAGES'):
+ get_locale().language = language
+
+ # Get record
+ pid_value = kwargs.get('pid_value')
+ try:
+ pid = PersistentIdentifier.get('depid', pid_value)
+ record = WekoRecord.get_record(pid.object_uuid)
+ except BaseException:
+ raise ContentsNotFoundError() # 404 Error
+
+ # Get files
+ from .utils import get_file_info_list
+ __, files = get_file_info_list(record)
+
+ filename = ''
+ terms_content = ''
+ for file in files:
+ if kwargs.get('file_name') == file.get('filename', ''):
+ filename = file.get('filename', '')
+ terms_content = file.get('terms_content', '')
+ break
+ if filename == '':
+ raise ContentsNotFoundError() # 404 Error
+
+ # Check ETag
+ etag = _generate_terms_token(filename, terms_content)
+ if check_etag(etag):
+ return make_response('304 Not Modified', 304)
+
+ # Create response
+ res_json = {
+ 'text': terms_content,
+ 'Etag': etag
+ }
+
+ response = make_response(jsonify(res_json), 200)
+ response.headers["Etag"] = etag
+ return response
+
+def _generate_terms_token(filename, terms_content):
+ return generate_etag('{}_{}'.format(filename, terms_content).encode("utf-8"))
+
+class FileApplication(ContentNegotiatedMethodView):
+ view_name = 'records_ui_{0}'
+
+ def __init__(self, *args, **kwargs):
+ """Constructor."""
+ super(FileApplication, self).__init__(*args, **kwargs)
+
+ @require_api_auth(True)
+ @require_oauth_scopes(activity_scope.id)
+ @limiter.limit('')
+ def post(self, **kwargs):
+ """
+ Post file application.
+
+ Returns:
+ Result json.
+ """
+ version = kwargs.get('version')
+ func_name = f'post_{version}'
+ if func_name in [func[0] for func in inspect.getmembers(self, inspect.ismethod)]:
+ return getattr(self, func_name)(**kwargs)
+ else:
+ raise VersionNotFoundRESTError() # 404 Error
+
+ def post_v1(self, **kwargs):
+ # Get parameter
+ language = str(request.headers.get('Accept-Language', 'en'))
+ param_pretty = str(request.values.get('pretty', 'false'))
+ request_terms_token = request.values.get('terms_token', None)
+ mail = request.values.get('mail', None)
+
+ # In case guest user
+ is_guest = False
+ if not current_user.is_authenticated:
+ try :
+ validate_email(mail, check_deliverability=False)
+ is_guest = True
+ except Exception as ex:
+ # invalid email
+ raise InvalidEmailError() # 400 Error
+
+ # Check pretty
+ check_pretty(param_pretty)
+
+ # Setting language
+ if language in current_app.config.get('WEKO_RECORDS_UI_API_ACCEPT_LANGUAGES'):
+ get_locale().language = language
+
+ # Get record
+ pid_value = kwargs.get('pid_value')
+ try:
+ pid = PersistentIdentifier.get('depid', pid_value)
+ except PIDDoesNotExistError:
+ raise ContentsNotFoundError() # 404 Error
+ record = WekoRecord.get_record(pid.object_uuid)
+ if not record:
+ raise ContentsNotFoundError() # 404 Error
+
+ # Get files info
+ from .utils import get_file_info_list
+ __, files = get_file_info_list(record)
+
+ # Get target file info
+ filename = ''
+ terms_content = ''
+ workflow_id = None
+ for file in files:
+ if kwargs.get('file_name') == file.get('filename', ''):
+ filename = file.get('filename', '')
+ terms_content = file.get('terms_content', '')
+ workflow_id = int(get_usage_workflow(file) or 0)
+ break
+ if filename == '':
+ raise ContentsNotFoundError() # 404 Error
+
+ # Get workflow
+ if not workflow_id:
+ # Available workflow not found
+ raise InvalidWorkflowError() # 403 Error
+ workflow = WorkFlow().get_workflow_by_id(workflow_id)
+ if not workflow:
+ # Workflow not found
+ raise ContentsNotFoundError() # 404 Error
+
+ # Check terms
+ if request_terms_token != _generate_terms_token(filename, terms_content):
+ raise InvalidTokenError() # 400 Error
+
+ # Create workflow activity
+ activity_id = ''
+ activity_url = ''
+ token = ''
+ try:
+ if is_guest:
+ # Prepare activity data.
+ data = {
+ 'itemtype_id': workflow.itemtype_id,
+ 'workflow_id': workflow_id,
+ 'flow_id': workflow.flow_id,
+ 'activity_confirm_term_of_use': True,
+ 'extra_info': {
+ "guest_mail": mail,
+ "record_id": record.get('recid'),
+ "related_title": record.get('title'),
+ "file_name": filename,
+ "is_restricted_access": True,
+ }
+ }
+ activity, activity_url = init_activity_for_guest_user(data)
+ if not activity:
+ guest_activity = GuestActivity.find(**data['extra_info'])
+ if guest_activity:
+ activity_id = guest_activity[0].activity_id
+ else:
+ activity_id = activity.activity_id
+
+ activity_url = activity_url.replace("/api", "", 1)
+ query_str = parse.urlparse(activity_url).query
+ query_dic = parse.parse_qs(query_str)
+ if query_dic and query_dic['token'] and len(query_dic['token']) > 0:
+ token = query_dic['token'][0]
+ else:
+ data = {
+ 'itemtype_id': workflow.itemtype_id,
+ 'workflow_id': workflow_id,
+ 'flow_id': workflow.flow_id,
+ 'activity_confirm_term_of_use': True,
+ 'extra_info': {
+ "user_mail": current_user.email,
+ "record_id": record.get('recid'),
+ "related_title": record.get('title'),
+ "file_name": filename,
+ "is_restricted_access": True,
+ }
+ }
+ activity = WorkActivity()
+ rtn = activity.init_activity(data)
+ if rtn is None:
+ raise
+ activity_id = rtn.activity_id
+ activity_url = url_for('weko_workflow.display_activity', activity_id=activity_id, _external=True, _method='GET').replace("/api", "", 1)
+
+ db.session.commit()
+ except SQLAlchemyError as ex:
+ current_app.logger.error("sqlalchemy error: {}".format(ex))
+ db.session.rollback()
+ raise InternalServerError()
+ except BaseException as ex:
+ current_app.logger.error('Unexpected error: {}'.format(ex))
+ db.session.rollback()
+ raise InternalServerError()
+
+ # Get item_type schema
+ item_type = ItemTypes.get_by_id(workflow.itemtype_id)
+
+ # Create response
+ res_json = {
+ "activity_id": activity_id,
+ "activity_url": activity_url,
+ "item_type_schema": item_type.schema
+ }
+ if token:
+ res_json['token'] = token
+
+ response = make_response(jsonify(res_json), 200)
+ return response
+
+
class WekoRecordsCitesResource(ContentNegotiatedMethodView):
"""Schema files resource."""
@@ -146,3 +581,155 @@ def get(self, pid_value, **kwargs):
'Citation formatting for record {0} failed.'.format(
str(record.id)))
return make_response(jsonify("Not found"), 404)
+
+
+class RequestMail(ContentNegotiatedMethodView):
+ view_name = 'records_ui_{0}'
+
+ def __init__(self, *args, **kwargs):
+ """Constructor."""
+ super(RequestMail, self).__init__(*args, **kwargs)
+
+ @limiter.limit('')
+ def post(self, **kwargs):
+ """
+ Post file application.
+
+ Returns:
+ Result json.
+ """
+ version = kwargs.get('version')
+ func_name = f'post_{version}'
+ if func_name in [func[0] for func in inspect.getmembers(self, inspect.ismethod)]:
+ return getattr(self, func_name)(**kwargs)
+ else:
+ raise VersionNotFoundRESTError() # 400 Error
+
+ def post_v1(self, **kwargs):
+ # Get parameter
+ language = str(request.headers.get('Accept-Language', 'en'))
+ param_pretty = str(request.values.get('pretty', 'false'))
+
+ # Check pretty
+ check_pretty(param_pretty)
+
+ # Setting language
+ if language in current_app.config.get('WEKO_RECORDS_UI_API_ACCEPT_LANGUAGES'):
+ get_locale().language = language
+
+ # Get record
+ pid_value = kwargs.get('pid_value')
+ pid = PersistentIdentifier.query.filter_by(
+ pid_type='recid', pid_value=str(pid_value)).first()
+
+ if not pid:
+ raise ContentsNotFoundError() # 404 Error
+
+ # Get request mail senders
+ request_body = request.get_json(force=True, silent=True)
+ msg_sender = request_body.get('from')
+ if not msg_sender:
+ raise RequiredItemNotExistError() # 400 Error
+
+ try:
+ # if is_guest:
+ # __, res_json = send_request_mail(pid, request_body, mail_address=email)
+ # else:
+ __, res_json = send_request_mail(pid.object_uuid, request_body)
+ except SQLAlchemyError as ex:
+ current_app.logger.exception('DB access Error')
+ raise InternalServerError()
+
+ response = make_response(jsonify(res_json), 200)
+ return response
+
+
+class CreateCaptchaImage(ContentNegotiatedMethodView):
+ view_name = 'records_ui_{0}'
+
+ def __init__(self, *args, **kwargs):
+ """Constructor."""
+ super(CreateCaptchaImage, self).__init__(*args, **kwargs)
+
+ @limiter.limit('')
+ def get(self, **kwargs):
+ """
+ Post file application.
+
+ Returns:
+ Result json.
+ """
+ version = kwargs.get('version')
+ func_name = f'get_{version}'
+ if func_name in [func[0] for func in inspect.getmembers(self, inspect.ismethod)]:
+ return getattr(self, func_name)(**kwargs)
+ else:
+ raise VersionNotFoundRESTError() # 404 Error
+
+ def get_v1(self, **kwargs):
+ # Get parameter
+ language = str(request.headers.get('Accept-Language', 'en'))
+ param_pretty = str(request.values.get('pretty', 'false'))
+
+ # Check pretty
+ check_pretty(param_pretty)
+
+ # Setting language
+ if language in current_app.config.get('WEKO_RECORDS_UI_API_ACCEPT_LANGUAGES'):
+ get_locale().language = language
+
+ # Generate CAPTCHA image
+ result, res_json = create_captcha_image()
+
+ if not result:
+ current_app.logger.error(res_json)
+ raise InternalServerError()
+
+ response = make_response(jsonify(res_json), 200)
+ return response
+
+class CaptchaAnswerValidation(ContentNegotiatedMethodView):
+
+ view_name = 'records_ui_{0}'
+
+ def __init__(self, *args, **kwargs):
+ """Constructor."""
+ super(CaptchaAnswerValidation, self).__init__(*args, **kwargs)
+
+ @limiter.limit('')
+ def post(self, **kwargs):
+ """
+ Post file application.
+ Returns:
+ Result json.
+ """
+ version = kwargs.get('version')
+ func_name = f'post_{version}'
+ if func_name in [func[0] for func in inspect.getmembers(self, inspect.ismethod)]:
+ return getattr(self, func_name)(**kwargs)
+ else:
+ raise VersionNotFoundRESTError() # 400 Error
+
+ def post_v1(self, **kwargs):
+ # Get parameter
+ language = str(request.headers.get('Accept-Language', 'en'))
+ param_pretty = str(request.values.get('pretty', 'false'))
+
+ # Check pretty
+ check_pretty(param_pretty)
+
+ # Setting language
+ if language in current_app.config.get('WEKO_RECORDS_UI_API_ACCEPT_LANGUAGES'):
+ get_locale().language = language
+
+ # Get request mail senders
+ request_body = request.get_json(force=True, silent=True)
+
+ try:
+ __, res_json = validate_captcha_answer(request_body)
+ except RedisError as ex:
+ current_app.logger.exception('Redis access Error')
+ raise InternalServerError()
+
+ response = make_response(jsonify(res_json), 200)
+ return response
\ No newline at end of file
diff --git a/modules/weko-records-ui/weko_records_ui/scopes.py b/modules/weko-records-ui/weko_records_ui/scopes.py
new file mode 100644
index 0000000000..21d39c72ab
--- /dev/null
+++ b/modules/weko-records-ui/weko_records_ui/scopes.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+#
+# This file is part of Invenio.
+# Copyright (C) 2016 CERN.
+#
+# Invenio is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# Invenio is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Invenio; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307, USA.
+#
+# In applying this license, CERN does not
+# waive the privileges and immunities granted to it by virtue of its status
+# as an Intergovernmental Organization or submit itself to any jurisdiction.
+
+"""WEKO3 module docstring."""
+
+from __future__ import absolute_import, print_function
+
+from flask_babelex import lazy_gettext as _
+from invenio_oauth2server.models import Scope
+
+item_read_scope = Scope(
+ id_='item:read',
+ group='item',
+ help_text=_('Allow read Item.'),
+)
+"""Scope to protect item."""
diff --git a/modules/weko-records-ui/weko_records_ui/static/css/weko_records_ui/style.css b/modules/weko-records-ui/weko_records_ui/static/css/weko_records_ui/style.css
index 6635439bd9..00e37de61c 100644
--- a/modules/weko-records-ui/weko_records_ui/static/css/weko_records_ui/style.css
+++ b/modules/weko-records-ui/weko_records_ui/static/css/weko_records_ui/style.css
@@ -100,3 +100,7 @@
background-color: #f7f7f7 !important;
border: 1px solid #ebebeb;
}
+
+.icon-space {
+ padding-right: 8px;
+}
\ No newline at end of file
diff --git a/modules/weko-records-ui/weko_records_ui/static/js/weko_records_ui/detail.js b/modules/weko-records-ui/weko_records_ui/static/js/weko_records_ui/detail.js
index 0867c716a1..ad97e56677 100644
--- a/modules/weko-records-ui/weko_records_ui/static/js/weko_records_ui/detail.js
+++ b/modules/weko-records-ui/weko_records_ui/static/js/weko_records_ui/detail.js
@@ -74,6 +74,45 @@ require([
);
});
+ function terms_only_guest_download(fileName,dataType,recordId,itemTypeId,workflowId,flowId){
+ const post_uri = '/workflow/activity/init-guest';
+ example='guest@example.com'
+ let post_data = {
+ guest_mail:example,
+ file_name: fileName,
+ guest_item_title: dataType,
+ record_id: recordId,
+ item_type_id: itemTypeId,
+ workflow_id: workflowId,
+ flow_id: flowId,
+ }
+ var deferred = new $.Deferred();
+ $.ajax({
+ url: post_uri,
+ method: 'POST',
+ async: true,
+ contentType: 'application/json',
+ data: JSON.stringify(post_data),
+ }).done(function (data) {
+ if (0 === data.code) {
+ let activity_url = data.data.redirect.split('/').slice(-1)[0];
+ let activity_id = activity_url.split('?')[0];
+ init_permission(recordId, fileName, activity_id);
+ document.location.href = data.data.redirect;
+ } else if(1 === data.code && data.data.is_download){
+ const url = new URL(data.data.redirect , document.location.origin);
+ url.searchParams.append('terms_of_use_only',true);
+ document.location.href = url;
+ } else {
+ alert(data.msg);
+ }
+ }).fail(function (jqXHE, status) {
+ console.log('fail:{}', jqXHE.message);
+ }).always(function() {
+ deferred.resolve();
+ })
+ return deferred;
+ }
function startWorkflow(workflowId, communityId, recordId, fileName, itemTitle) {
let post_uri = $('#post_uri').text();
@@ -94,25 +133,32 @@ require([
if (typeof communityId !== 'undefined' && communityId !== "") {
post_uri = post_uri + "?community=" + communityId;
}
+ var deferred = new $.Deferred();
$.ajax({
url: post_uri,
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(post_data),
- success: function (data) {
- if (0 === data.code) {
- let activity_url = data.data.redirect.split('/').slice(-1)[0];
- let activity_id = activity_url.split('?')[0];
- init_permission(recordId, fileName, activity_id);
- document.location.href = data.data.redirect;
- } else {
- alert(data.msg);
- }
- },
- error: function (jqXHE, status) {
+ }).done(function (data) {
+ if (0 === data.code) {
+ let activity_url = data.data.redirect.split('/').slice(-1)[0];
+ let activity_id = activity_url.split('?')[0];
+ init_permission(recordId, fileName, activity_id);
+ document.location.href = data.data.redirect;
+ } else if(1 === data.code && data.data.is_download){
+ const url = new URL(data.data.redirect , document.location.origin);
+ url.searchParams.append('terms_of_use_only',true);
+ document.location.href = url;
+ } else {
+ alert(data.msg);
}
- });
- }
+ }).fail(function (jqXHE, status) {
+ console.log('fail:{}', jqXHE.message);
+ }).always(function() {
+ deferred.resolve();
+ })
+ return deferred;
+ };
function init_permission(record_id, file_name, activity_id) {
let init_permission_uri = '/records/permission/';
@@ -144,15 +190,18 @@ require([
});
$('.term_checked').on('click', function () {
- var file_version_id = $('#' + this.id).data('file-version-id');
- let $nextAction = $("#term_next_" + file_version_id);
- if ($('#term_checked_' + file_version_id).prop("checked") == true) {
- $nextAction.removeClass("disabled");
- $(this).attr("checked");
- $nextAction.attr("disabled", false);
+ var file_version_id = $(this).data('file-version-id');
+ let $nextActionBtn = $("#term_next");
+ if (file_version_id != null) {
+ $nextActionBtn = $("#term_next_" + file_version_id);
+ }
+ if ($(this).prop("checked") == true) {
+ $nextActionBtn.removeClass("disabled");
+ $nextActionBtn.prop('disabled', false);
+ $('input[type="checkbox"][name="term_check"]').prop('checked', true)
} else {
- $nextAction.addClass("disabled");
- $nextAction.attr("disabled", true);
+ $nextActionBtn.addClass("disabled");
+ $nextActionBtn.prop('disabled', true);
}
});
@@ -169,41 +218,80 @@ require([
});
$('.btn-start-guest-wf').on('click', function () {
- let $confirmEmailBtn = $("#confirm_email_btn");
- $confirmEmailBtn.data("guest_filename_data", $(this).data("guest_filename_data"));
- $confirmEmailBtn.data("guest_data_type_title", $(this).data("guest_data_type_title"));
- $confirmEmailBtn.data("guest_record_id", $(this).data("guest_record_id"));
- $confirmEmailBtn.data("guest_itemtype_id", $(this).data("guest_itemtype_id"));
- $confirmEmailBtn.data("guest_workflow_id", $(this).data("guest_workflow_id"));
- $confirmEmailBtn.data("guest_flow_id", $(this).data("guest_flow_id"));
- $("#email_modal").modal("show");
+ let isTermsOnly = $("#is_terms_only").val();
+ if(isTermsOnly==="True"){
+ var file_version_id = $("#" + this.id).data('file-version-id')
+ let fileName = $(this).data("guest_filename_data");
+ let dataType = $(this).data("guest_data_type_title");
+ let recordId = $(this).data("guest_record_id");
+ let itemTypeId = $(this).data("guest_itemtype_id");
+ let workflowId = $(this).data("guest_workflow_id");
+ let flowId = $(this).data("guest_flow_id");
+ var deferred = terms_only_guest_download(fileName,dataType,recordId,itemTypeId,workflowId,flowId);
+ deferred.done(function(){
+ $("#term_and_condtion_modal_" + file_version_id).modal("hide");
+ });
+ }else{
+ let $confirmEmailBtn = $("#confirm_email_btn");
+ $confirmEmailBtn.data("guest_filename_data", $(this).data("guest_filename_data"));
+ $confirmEmailBtn.data("guest_data_type_title", $(this).data("guest_data_type_title"));
+ $confirmEmailBtn.data("guest_record_id", $(this).data("guest_record_id"));
+ $confirmEmailBtn.data("guest_itemtype_id", $(this).data("guest_itemtype_id"));
+ $confirmEmailBtn.data("guest_workflow_id", $(this).data("guest_workflow_id"));
+ $confirmEmailBtn.data("guest_flow_id", $(this).data("guest_flow_id"));
+ $("#email_modal").modal("show");
+ }
});
$('.term_next').on('click', function () {
- var file_version_id = $("#" + this.id).data('file-version-id')
- let isGuest = $("#term_next_" + file_version_id).data("guest");
- if (isGuest == "True") {
+ var file_version_id = $(this).data('file-version-id')
+ let isGuest = $(this).data("guest");
+ let isTermsOnly = $("#is_terms_only").val();
+ let startGuestWorkflowId = "#btn-start-guest-wf";
+ let startNormalWorkflowId = "#btn-start-workflow";
+ let termsAndConditionModalId = "#term_and_condtion_modal";
+ if(file_version_id != null) {
+ startGuestWorkflowId = "#btn-start-guest-wf-" + file_version_id
+ startNormalWorkflowId = "#btn-start-workflow-" + file_version_id
+ termsAndConditionModalId = "#term_and_condtion_modal-" + file_version_id
+ }
+ if (isGuest == "True" && isTermsOnly == "True") {
+ const $btnStartGuestTermOnly=$(startGuestWorkflowId);
+ let fileName = $btnStartGuestTermOnly.data('guest_filename_data');
+ let dataType = $btnStartGuestTermOnly.data('guest_data_type_title');
+ let recordId = $btnStartGuestTermOnly.data('guest_record_id');
+ let itemTypeId = $btnStartGuestTermOnly.data('guest_itemtype_id');
+ let workflowId = $btnStartGuestTermOnly.data('guest_workflow_id');
+ let flowId = $btnStartGuestTermOnly.data('guest_flow_id');
+ var deferred = terms_only_guest_download(fileName,dataType,recordId,itemTypeId,workflowId,flowId);
+ deferred.done(function(){
+ $(termsAndConditionModalId).modal("hide");
+ });
+ } else if(isGuest=="True"){
let $confirmEmailBtn = $("#confirm_email_btn");
- let btnSender = $("#btn-start-guest-wf-" + file_version_id)
+ let btnSender = $(startGuestWorkflowId);
$confirmEmailBtn.attr("data-guest_filename_data", btnSender.data("guest_filename_data"));
$confirmEmailBtn.attr("data-guest_data_type_title", btnSender.data("guest_data_type_title"));
$confirmEmailBtn.attr("data-guest_record_id", btnSender.data("guest_record_id"));
$confirmEmailBtn.attr("data-guest_itemtype_id", btnSender.data("guest_itemtype_id"));
$confirmEmailBtn.attr("data-guest_workflow_id", btnSender.data("guest_workflow_id"));
$confirmEmailBtn.attr("data-guest_flow_id", btnSender.data("guest_flow_id"));
- $("#term_and_condtion_modal_" + file_version_id).modal('toggle');
+ $(termsAndConditionModalId).modal('toggle');
setTimeout(function () {
$("#email_modal").modal("show");
}, 0);
} else {
- let $btnStartWorkflow = $("#btn-start-workflow-" + file_version_id);
+ let $btnStartWorkflow = $(startNormalWorkflowId);
let workflowId = $btnStartWorkflow.data('workflow-id');
let communityId = $btnStartWorkflow.data('community');
let recordId = $btnStartWorkflow.data('record-id');
let fileName = $btnStartWorkflow.data('filename');
let itemTitle =$btnStartWorkflow.data('itemtitle');
- startWorkflow(workflowId, communityId, recordId, fileName, itemTitle);
+ var deferred = startWorkflow(workflowId, communityId, recordId, fileName, itemTitle);
+ deferred.done(function(){
+ $(termsAndConditionModalId).modal("hide");
+ });
}
});
@@ -235,4 +323,87 @@ require([
$('#citationResult').html(current_cite);
}
});
+
+ $('#secret_url')?.on('click', function(){
+ const webelement = $('#secret_url');
+ if (webelement){
+ const url = webelement.attr('url');
+ webelement.prop('disabled' ,true);
+ $.ajax({
+ url: url,
+ method: 'POST',
+ contentType: 'application/json',
+ data: null,
+ success: function (responce) {
+ webelement.prop('disabled',false);
+ alert(responce);
+ },
+ error: function (jqXHE, status ,msg) {
+ webelement.prop('disabled',false);
+ alert(msg);
+ }
+ });
+ }
+ });
+
+ $('#print-btn')?.on('click',() => {
+ const iframe = document.createElement('iframe');
+ iframe.srcdoc = ""
+ document.body.appendChild(iframe);
+ iframe.onload = () => {
+ iframe.contentDocument.body.appendChild(document.getElementById('terms').cloneNode(true));
+ iframe.contentWindow.print();
+ }
+ })
});
+
+
+$('#close_btn, #modal_close_btn').on('click', function () {
+ document.location.href = location.pathname;
+ })
+$('#mailcheck_download_modal').on('hidden.bs.modal', function () {
+ document.location.href = location.pathname;
+})
+$('#mailaddress_confirm_download').click(function () {
+ let mailaddress = document.getElementById('mail_form').value;
+ let password_checkflag = document.getElementById("password_checkflag").value;
+ var input_password;
+ var post_data = {};
+ if(password_checkflag == "True"){
+ input_password = document.getElementById('input_password').value;
+ post_data = {'input_password': input_password};
+}
+ let input_error = document.getElementById('input_error_messsge').value;
+ let url_element = document.getElementById('url_element');
+ let onetime_file_url = url_element.dataset.onetime_file_url;
+ const get_uri = onetime_file_url + '&mailaddress='+ mailaddress + '&isajax=true';
+ let item_detailes_url = location.pathname;
+ if(mailaddress == null || mailaddress == ""){
+ alert(input_error);
+ document.location.href = onetime_file_url;
+ }else{
+ $.ajax({
+ url: get_uri,
+ method: 'POST',
+ async: true,
+ data: JSON.stringify(post_data),
+ contentType: 'application/json',
+ success: function (response) {
+ let link = document.createElement("a");
+ link.download = "";
+ link.href = get_uri;
+ link.click();
+ $('#mailcheck_download_modal').modal('hide');
+ document.location.href = item_detailes_url;
+ },
+ error: function (error) {
+ response_text = error['responseText'];
+ alert(response_text);
+ $('#mailcheck_download_modal').modal('hide');
+ document.location.href = item_detailes_url;
+ }
+ })
+ }
+}
+);
+
diff --git a/modules/weko-records-ui/weko_records_ui/static/js/weko_records_ui/file_action.js b/modules/weko-records-ui/weko_records_ui/static/js/weko_records_ui/file_action.js
index 83304898bc..4b06bd1aa4 100644
--- a/modules/weko-records-ui/weko_records_ui/static/js/weko_records_ui/file_action.js
+++ b/modules/weko-records-ui/weko_records_ui/static/js/weko_records_ui/file_action.js
@@ -98,8 +98,18 @@ $(document).ready(function () {
function validateUserEmail(email, confirmEmail) {
- let regex = /^([a-zA-Z0-9_.+-])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
- return (email && confirmEmail && email === confirmEmail && regex.test(email))
+ let regex = /^([a-zA-Z0-9_.+-])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
+ return (email && confirmEmail && email === confirmEmail && regex.test(email))
+ }
+
+ function validatePassword(password, confirmPassword){
+ let password_checkflag = document.getElementById("password_checkflag").value;
+ let regex = /^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[@!#\$%&=\-\+\*\/\.,:;\[\]\|])[a-zA-Z0-9@!#\$%&=\-\+\*\/\.,:;\[\]\|]{8,}$/;
+ if (password_checkflag == "True"){
+ return (password && confirmPassword && password === confirmPassword && regex.test(password))
+ }else{
+ return true;
+ }
}
$('#confirm_email_btn').click(function () {
@@ -107,7 +117,16 @@ $(document).ready(function () {
let userMailConfirmElement = $('#user_mail_confirm');
let user_mail = userMailElement.val();
let user_mail_confirm = userMailConfirmElement.val();
- if (validateUserEmail(user_mail, user_mail_confirm)) {
+ let passwordElement = $('#password_for_download');
+ let passwordConfirmElement = $('#password_for_download_confirm');
+ let password_checkflag = document.getElementById("password_checkflag").value;
+ var password_check = true;
+ if(password_checkflag == "True"){
+ var password_for_download = passwordElement.val();
+ var password_for_download_confirm = passwordConfirmElement.val();
+ password_check = validatePassword(password_for_download, password_for_download_confirm);
+ }
+ if (validateUserEmail(user_mail, user_mail_confirm) && password_check) {
let fileName = $(this).data("guest_filename_data");
let dataType = $(this).data("guest_data_type_title");
let recordID = $(this).data("guest_record_id");
@@ -118,6 +137,7 @@ $(document).ready(function () {
const post_uri = '/workflow/activity/init-guest';
let post_data = {
guest_mail: user_mail,
+ password_for_download: password_for_download,
file_name: fileName,
guest_item_title: dataType,
record_id: recordID.toString(),
@@ -134,7 +154,15 @@ $(document).ready(function () {
success: function (res) {
userMailElement.val('');
userMailConfirmElement.val('');
+ passwordElement.val('');
+ passwordConfirmElement.val('');
$('#email_modal').modal('hide');
+ if(1 === res.code && res.data.is_download){
+ const url = new URL(res.data.redirect, document.location.origin);
+ url.searchParams.append('terms_of_use_only',true);
+ document.location.href = url;
+ return;
+ }
$("#modalSendEmailSuccess #inputModal").html(res.msg);
$("#modalSendEmailSuccess").modal("show");
},
@@ -157,4 +185,18 @@ $(document).ready(function () {
$('.user_mail_confirm').addClass('has-error');
}
});
+
+ $('#password_for_download, #password_for_download_confirm').on('input', function () {
+ let password_for_download = $('#password_for_download').val();
+ let password_for_download_confirm = $('#password_for_download_confirm').val();
+ if (validatePassword(password_for_download, password_for_download_confirm)) {
+ $('.password_for_download').removeClass('has-error');
+ $('.password_for_download_confirm').removeClass('has-error');
+ $("#confirm_email_btn").removeAttr("disabled");
+ } else {
+ $("#confirm_email_btn").attr("disabled", true);
+ $('.password_for_download').addClass('has-error');
+ $('.password_for_download_confirm').addClass('has-error');
+ }
+ });
});
diff --git a/modules/weko-records-ui/weko_records_ui/static/js/weko_records_ui/request_mail.js b/modules/weko-records-ui/weko_records_ui/static/js/weko_records_ui/request_mail.js
new file mode 100644
index 0000000000..ce830fffb8
--- /dev/null
+++ b/modules/weko-records-ui/weko_records_ui/static/js/weko_records_ui/request_mail.js
@@ -0,0 +1,110 @@
+$('#request_mail_btn')?.on('click', () => {
+ const CALCULATION_MESSAGE = document.getElementById("calculation_message_initial").value;
+ $("#calculation_message").text(CALCULATION_MESSAGE);
+ clear_mail_form()
+ // Get captcha and show modal
+ load_captcha_image().done((response) => {
+ $("#request_mail_dialog").modal("show");
+ }).fail((jqXHE, status, msg) => {
+ alert(msg);
+ });
+})
+
+let mail_form = $('#request_mail_form')
+ mail_form?.on('submit', (e) => {
+ // Get request mail info and post to send email
+ e.preventDefault();
+
+ const ttl = $("#ttl").val();
+ const dt = $("#dt").val();
+ const nowDate = new Date();
+ const limitDateSeconds = new Date(dt).setSeconds(new Date(dt).getSeconds() + parseInt(ttl));
+ const limitDate = new Date(limitDateSeconds);
+ const FAILED_MESSAGE = document.getElementById("failed_message").value;
+ const CAPTCHA_IMAGE_TIMEOUT = document.getElementById("captcha_image_timeout").value;
+
+ if (nowDate > limitDate) {
+ $("#calculation_message").text(CAPTCHA_IMAGE_TIMEOUT);
+ load_captcha_image().done((response) => {
+ $("#calculation_result").val("");
+ }).fail(function (jqXHE, status, msg) {
+ alert(msg);
+ });
+ } else {
+ const webelement = $('#confirm_send_button');
+ webelement.prop('disabled', true);
+ const authorization_url = '/api/v1/captcha/validate';
+ const authorization_body = {
+ 'key': $('#key').val(),
+ 'calculation_result': parseInt($('#calculation_result').val(), 10)
+ };
+ $.ajax({
+ url: authorization_url,
+ method: 'POST',
+ data: JSON.stringify(authorization_body),
+ contentType: 'application/json',
+ dataType: 'json'
+ }).then((response) => {
+ const re = /records\/(.+)/;
+ const reg_result = re.exec(location.pathname);
+ const recid = reg_result[1];
+ const url = ['/api/v1/records', recid, 'request-mail'].join('/');
+ // write content
+ const request_mail_body = {
+ 'from': $('#request_mail_sender').val(),
+ 'subject': $('#subject').val(),
+ 'message': $('#body').val(),
+ 'key': $('#key').val(),
+ 'authorization_token': response.authorization_token
+ };
+ return $.ajax({
+ url: url,
+ method: 'POST',
+ data: JSON.stringify(request_mail_body),
+ contentType: 'application/json',
+ dataType: 'json'
+ });
+ }).then((response) => {
+ const EMAIL_SENT_SUCCESSFULLY = document.getElementById("email_sent_successfully").value
+ webelement.prop('disabled', false);
+ alert(EMAIL_SENT_SUCCESSFULLY);
+ clear_mail_form()
+ $("#calculation_message").val("");
+ }).fail((jqXHE, status, msg) => {
+ webelement.prop('disabled', false);
+ if (jqXHE.status == 500) {
+ alert("Internal Server Error.")
+ } else {
+ alert(FAILED_MESSAGE);
+ }
+ load_captcha_image().done((response) => {
+ const CALCULATION_MESSAGE = document.getElementById("calculation_message_initial").value;
+ $("#calculation_result").val("");
+ $("#calculation_message").text(CALCULATION_MESSAGE);
+ }).fail(function (jqXHE, status, msg) {
+ alert(msg);
+ });
+ });
+ }
+})
+
+function load_captcha_image() {
+ return $.ajax({
+ url: '/api/v1/captcha/image',
+ async: false,
+ method: 'GET'
+ }).then((response) => {
+ const dt = new Date();
+ $("#request_captcha").attr('src', "data:image/png;base64," + response.image)
+ $("#key").val(response.key);
+ $("#ttl").val(response.ttl);
+ $("#dt").val(dt);
+ })
+}
+
+function clear_mail_form() {
+ $('#request_mail_sender').val("");
+ $('#subject').val("");
+ $('#body').val("");
+ $("#calculation_result").val("");
+}
\ No newline at end of file
diff --git a/modules/weko-records-ui/weko_records_ui/templates/weko_records_ui/_macros.html b/modules/weko-records-ui/weko_records_ui/templates/weko_records_ui/_macros.html
index be11022497..4365a0c9ec 100644
--- a/modules/weko-records-ui/weko_records_ui/templates/weko_records_ui/_macros.html
+++ b/modules/weko-records-ui/weko_records_ui/templates/weko_records_ui/_macros.html
@@ -20,7 +20,7 @@
{% macro check_download_file(record, file, permission, community, url_for_security, is_file_name_url, file_label) %}
+ value="{{restricted_errorMsg}}"/>
{% set is_guest = False %}
{% if not session['user_id'] %}
{% set is_guest = True %}
@@ -33,10 +33,12 @@
{% set workflow_id = file | get_usage_workflow %}
{% set start_guest_wf = workflow_id is not none and access_role == "open_restricted" %}
{% if start_guest_wf %}
- {% set workflow_detail = workflow_id | get_workflow_detail() %}
+ {% set workflow_detail,is_terms_only = workflow_id | get_workflow_detail() %}
{% set item_type_id = workflow_detail.itemtype_id %}
{% set flow_id = workflow_detail.flow_id %}
{% endif %}
+
{% if file.terms and start_guest_wf %}
- {%- if email_display_flg == '1' %}
-
-
- {{_("Display Email")}}
-
-
-
- {{_("Hide Email")}}
-
- {%- else %}
-
-
- {{_("Display Email")}}
-
-
-
- {{_("Hide Email")}}
-
- {%- endif %}
+
+
+ {{_("Display Email")}}
+
+
+
+ {{_("Hide Email")}}
+
@@ -61,25 +50,29 @@
{{_('Open Date')}}
- {%- if open_date_display_flg == '1' %}
-
-
- {{_("Display")}}
-
-
-
- {{_("Hide Open Date")}}
-
- {%- else %}
-
-
- {{_("Display")}}
-
-
-
- {{_("Hide Open Date")}}
-
- {%- endif %}
+
+
+ {{_("Display")}}
+
+
+
+ {{_("Hide Open Date")}}
+
+
+
+
diff --git a/modules/weko-records-ui/weko_records_ui/templates/weko_records_ui/body_contents.html b/modules/weko-records-ui/weko_records_ui/templates/weko_records_ui/body_contents.html
index 71620de592..623a84d308 100644
--- a/modules/weko-records-ui/weko_records_ui/templates/weko_records_ui/body_contents.html
+++ b/modules/weko-records-ui/weko_records_ui/templates/weko_records_ui/body_contents.html
@@ -22,7 +22,7 @@
{% from "weko_records_ui/box/preview_carousel.html" import preview_carousel %}
{% from "weko_theme/macros/modal_page.html" import all_modal, email_modal %}
-{{ email_modal('email_modal', 'confirm_email_btn', _('Send'),_('Please input email address.')) }}
+{{ email_modal('email_modal', 'confirm_email_btn', _('Send'),_('Please input email address.'),password_checkflag,with_files) }}
{{ all_modal() }}
{%- block javascript %}
@@ -31,6 +31,7 @@
{% from "weko_records_ui/item_detail.html" import output_item_detail with context %}
{% from "weko_records_ui/_macros.html" import check_download_file with context %}
+{% from "weko_records_ui/box/item_usage_application.html" import check_item_application with context %}
@@ -421,6 +422,10 @@
{{_('
{% endif %}
{% endif %}
{% endif %}
+ {% if is_display_request_form %}
+ {%- include "weko_records_ui/box/request.html" %}
+ {% endif %}
+ {{ check_item_application(record, community, url_for_security) }}
{% if config.WEKO_RECORDS_UI_DISPLAY_VERSION_BOX_FLG %}
{%- include "weko_records_ui/box/versions.html" %}
{% endif %}
@@ -456,6 +461,61 @@ {{_('
+{%-if mailcheckflag %}
+
+
+
+
+
+
+
+ {{ _('Email address') }}
+
+
+ {%- if password_checkflag %}
+
+ {%- endif %}
+
+
+
+
+
+{%- endif %}
{% block css %}
'),this.getInertBodyElement=this.inertBodyElement.querySelector&&this.inertBodyElement.querySelector("svg img")&&function(){try{return!!window.DOMParser}catch(e){return!1}}()?this.getInertBodyElement_DOMParser:this.getInertBodyElement_InertDocument):this.getInertBodyElement=this.getInertBodyElement_XHR}return e.prototype.getInertBodyElement_XHR=function(e){e="
"+e+"";try{e=encodeURI(e)}catch(e){return null}var t=new XMLHttpRequest;t.responseType="document",t.open("GET","data:text/html;charset=utf-8,"+e,!1),t.send(null);var n=t.response.body;return n.removeChild(n.firstChild),n},e.prototype.getInertBodyElement_DOMParser=function(e){e="
"+e+"";try{var t=(new window.DOMParser).parseFromString(e,"text/html").body;return t.removeChild(t.firstChild),t}catch(e){return null}},e.prototype.getInertBodyElement_InertDocument=function(e){var t=this.DOM.createElement("template");return"content"in t?(this.DOM.setInnerHTML(t,e),t):(this.DOM.setInnerHTML(this.inertBodyElement,e),this.defaultDoc.documentMode&&this.stripCustomNsAttrs(this.inertBodyElement),this.inertBodyElement)},e.prototype.stripCustomNsAttrs=function(e){var t=this;this.DOM.attributeMap(e).forEach(function(n,r){"xmlns:ns1"!==r&&0!==r.indexOf("ns1:")||t.DOM.removeAttribute(e,r)});for(var n=0,r=this.DOM.childNodesAsList(e);n
")):this.sanitizedSomething=!0},e.prototype.endElement=function(e){var t=this.DOM.nodeName(e).toLowerCase();uu.hasOwnProperty(t)&&!ou.hasOwnProperty(t)&&(this.buf.push(""),this.buf.push(t),this.buf.push(">"))},e.prototype.chars=function(e){this.buf.push(yu(e))},e.prototype.checkClobberedElement=function(e,t){if(t&&this.DOM.contains(e,t))throw new Error("Failed to sanitize html because the element is clobbered: "+this.DOM.getOuterHTML(e));return t},e}(),fu=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,hu=/([^\#-~ |!])/g;function yu(e){return e.replace(/&/g,"&").replace(fu,function(e){return""+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";"}).replace(hu,function(e){return""+e.charCodeAt(0)+";"}).replace(//g,">")}var gu=new RegExp("^([-,.\"'%_!# a-zA-Z0-9]+|(?:(?:matrix|translate|scale|rotate|skew|perspective)(?:X|Y|3d)?|(?:rgb|hsl)a?|(?:repeating-)?(?:linear|radial)-gradient|(?:calc|attr))\\([-0-9.%, #a-zA-Z]+\\))$","g"),vu=/^url\(([^)]+)\)$/,mu=function(){},bu=function(e){function t(t){var n=e.call(this)||this;return n._doc=t,n}return o(t,e),t.prototype.sanitize=function(e,t){if(null==t)return null;switch(e){case Cn.NONE:return t;case Cn.HTML:return t instanceof _u?t.changingThisBreaksApplicationSecurity:(this.checkNotSafeValue(t,"HTML"),function(e,t){var n=Ks(),r=null;try{ru=ru||new Ya(e,n);var o=t?String(t):"";r=ru.getInertBodyElement(o);var i=5,s=o;do{if(0===i)throw new Error("Failed to sanitize html because the input is unstable");i--,o=s,s=n.getInnerHTML(r),r=ru.getInertBodyElement(o)}while(o!==s);var a=new pu,u=a.sanitizeChildren(n.getTemplateContent(r)||r);return At()&&a.sanitizedSomething&&n.log("WARNING: sanitizing HTML stripped some content (see http://g.co/ng/security#xss)."),u}finally{if(r)for(var l=n.getTemplateContent(r)||r,c=0,d=n.childNodesAsList(l);c0){var r=e.slice(0,t),o=e.slice(t+1).trim();n.set(r,o)}}),n},e.prototype.append=function(e,t){var n=this.getAll(e);null===n?this.set(e,t):n.push(t)},e.prototype.delete=function(e){var t=e.toLowerCase();this._normalizedNames.delete(t),this._headers.delete(t)},e.prototype.forEach=function(e){var t=this;this._headers.forEach(function(n,r){return e(n,t._normalizedNames.get(r),t._headers)})},e.prototype.get=function(e){var t=this.getAll(e);return null===t?null:t.length>0?t[0]:null},e.prototype.has=function(e){return this._headers.has(e.toLowerCase())},e.prototype.keys=function(){return Array.from(this._normalizedNames.values())},e.prototype.set=function(e,t){Array.isArray(t)?t.length&&this._headers.set(e.toLowerCase(),[t.join(",")]):this._headers.set(e.toLowerCase(),[t]),this.mayBeSetNormalizedName(e)},e.prototype.values=function(){return Array.from(this._headers.values())},e.prototype.toJSON=function(){var e=this,t={};return this._headers.forEach(function(n,r){var o=[];n.forEach(function(e){return o.push.apply(o,e.split(","))}),t[e._normalizedNames.get(r)]=o}),t},e.prototype.getAll=function(e){return this.has(e)&&this._headers.get(e.toLowerCase())||null},e.prototype.entries=function(){throw new Error('"entries" method is not implemented on Headers class')},e.prototype.mayBeSetNormalizedName=function(e){var t=e.toLowerCase();this._normalizedNames.has(t)||this._normalizedNames.set(t,e)},e}(),Pu=function(){function e(e){void 0===e&&(e={});var t=e.body,n=e.status,r=e.headers,o=e.statusText,i=e.type,s=e.url;this.body=null!=t?t:null,this.status=null!=n?n:null,this.headers=null!=r?r:null,this.statusText=null!=o?o:null,this.type=null!=i?i:null,this.url=null!=s?s:null}return e.prototype.merge=function(t){return new e({body:t&&null!=t.body?t.body:this.body,status:t&&null!=t.status?t.status:this.status,headers:t&&null!=t.headers?t.headers:this.headers,statusText:t&&null!=t.statusText?t.statusText:this.statusText,type:t&&null!=t.type?t.type:this.type,url:t&&null!=t.url?t.url:this.url})},e}(),ju=function(e){function t(){return e.call(this,{status:200,statusText:"Ok",type:Ou.Default,headers:new Mu})||this}return o(t,e),t}(Pu),Lu=function(){};function Vu(e){if("string"!=typeof e)return e;switch(e.toUpperCase()){case"GET":return Iu.Get;case"POST":return Iu.Post;case"PUT":return Iu.Put;case"DELETE":return Iu.Delete;case"OPTIONS":return Iu.Options;case"HEAD":return Iu.Head;case"PATCH":return Iu.Patch}throw new Error('Invalid request method. The method "'+e+'" is not supported.')}var Fu=function(e){return e>=200&&e<300},Hu=function(){function e(){}return e.prototype.encodeKey=function(e){return Bu(e)},e.prototype.encodeValue=function(e){return Bu(e)},e}();function Bu(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/gi,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%2B/gi,"+").replace(/%3D/gi,"=").replace(/%3F/gi,"?").replace(/%2F/gi,"/")}var qu=function(){function e(e,t){void 0===e&&(e=""),void 0===t&&(t=new Hu),this.rawParams=e,this.queryEncoder=t,this.paramsMap=function(e){void 0===e&&(e="");var t=new Map;return e.length>0&&e.split("&").forEach(function(e){var n=e.indexOf("="),r=-1==n?[e,""]:[e.slice(0,n),e.slice(n+1)],o=r[0],i=r[1],s=t.get(o)||[];s.push(i),t.set(o,s)}),t}(e)}return e.prototype.clone=function(){var t=new e("",this.queryEncoder);return t.appendAll(this),t},e.prototype.has=function(e){return this.paramsMap.has(e)},e.prototype.get=function(e){var t=this.paramsMap.get(e);return Array.isArray(t)?t[0]:null},e.prototype.getAll=function(e){return this.paramsMap.get(e)||[]},e.prototype.set=function(e,t){if(void 0!==t&&null!==t){var n=this.paramsMap.get(e)||[];n.length=0,n.push(t),this.paramsMap.set(e,n)}else this.delete(e)},e.prototype.setAll=function(e){var t=this;e.paramsMap.forEach(function(e,n){var r=t.paramsMap.get(n)||[];r.length=0,r.push(e[0]),t.paramsMap.set(n,r)})},e.prototype.append=function(e,t){if(void 0!==t&&null!==t){var n=this.paramsMap.get(e)||[];n.push(t),this.paramsMap.set(e,n)}},e.prototype.appendAll=function(e){var t=this;e.paramsMap.forEach(function(e,n){for(var r=t.paramsMap.get(n)||[],o=0;o=200&&n.status<=299,n.statusText=t.statusText,n.headers=t.headers,n.type=t.type,n.url=t.url,n}return o(t,e),t.prototype.toString=function(){return"Response with status: "+this.status+" "+this.statusText+" for URL: "+this.url},t}(Uu),zu=/^\)\]\}',?\n/,Wu=function(){function e(e,t,n){var r=this;this.request=e,this.response=new S(function(o){var i=t.build();i.open(Iu[e.method].toUpperCase(),e.url),null!=e.withCredentials&&(i.withCredentials=e.withCredentials);var s=function(){var t=1223===i.status?204:i.status,r=null;204!==t&&"string"==typeof(r=void 0===i.response?i.responseText:i.response)&&(r=r.replace(zu,"")),0===t&&(t=r?200:0);var s,a=Mu.fromResponseHeaderString(i.getAllResponseHeaders()),u=("responseURL"in(s=i)?s.responseURL:/^X-Request-URL:/m.test(s.getAllResponseHeaders())?s.getResponseHeader("X-Request-URL"):null)||e.url,l=new Pu({body:r,status:t,headers:a,statusText:i.statusText||"OK",url:u});null!=n&&(l=n.merge(l));var c=new $u(l);if(c.ok=Fu(t),c.ok)return o.next(c),void o.complete();o.error(c)},a=function(e){var t=new Pu({body:e,type:Ou.Error,status:i.status,statusText:i.statusText});null!=n&&(t=n.merge(t)),o.error(new $u(t))};if(r.setDetectedContentType(e,i),null==e.headers&&(e.headers=new Mu),e.headers.has("Accept")||e.headers.append("Accept","application/json, text/plain, */*"),e.headers.forEach(function(e,t){return i.setRequestHeader(t,e.join(","))}),null!=e.responseType&&null!=i.responseType)switch(e.responseType){case Du.ArrayBuffer:i.responseType="arraybuffer";break;case Du.Json:i.responseType="json";break;case Du.Text:i.responseType="text";break;case Du.Blob:i.responseType="blob";break;default:throw new Error("The selected responseType is not supported")}return i.addEventListener("load",s),i.addEventListener("error",a),i.send(r.request.getBody()),function(){i.removeEventListener("load",s),i.removeEventListener("error",a),i.abort()}})}return e.prototype.setDetectedContentType=function(e,t){if(null==e.headers||null==e.headers.get("Content-Type"))switch(e.contentType){case Ru.NONE:break;case Ru.JSON:t.setRequestHeader("content-type","application/json");break;case Ru.FORM:t.setRequestHeader("content-type","application/x-www-form-urlencoded;charset=UTF-8");break;case Ru.TEXT:t.setRequestHeader("content-type","text/plain");break;case Ru.BLOB:var n=e.blob();n.type&&t.setRequestHeader("content-type",n.type)}},e}(),Zu=function(){function e(e,t){void 0===e&&(e="XSRF-TOKEN"),void 0===t&&(t="X-XSRF-TOKEN"),this._cookieName=e,this._headerName=t}return e.prototype.configureRequest=function(e){var t=Ks().getCookie(this._cookieName);t&&e.headers.set(this._headerName,t)},e}(),Gu=function(){function e(e,t,n){this._browserXHR=e,this._baseResponseOptions=t,this._xsrfStrategy=n}return e.prototype.createConnection=function(e){return this._xsrfStrategy.configureRequest(e),new Wu(e,this._browserXHR,this._baseResponseOptions)},e}(),Qu=function(){function e(e){void 0===e&&(e={});var t=e.method,n=e.headers,r=e.body,o=e.url,i=e.search,s=e.params,a=e.withCredentials,u=e.responseType;this.method=null!=t?Vu(t):null,this.headers=null!=n?n:null,this.body=null!=r?r:null,this.url=null!=o?o:null,this.params=this._mergeSearchParams(s||i),this.withCredentials=null!=a?a:null,this.responseType=null!=u?u:null}return Object.defineProperty(e.prototype,"search",{get:function(){return this.params},set:function(e){this.params=e},enumerable:!0,configurable:!0}),e.prototype.merge=function(t){return new e({method:t&&null!=t.method?t.method:this.method,headers:t&&null!=t.headers?t.headers:new Mu(this.headers),body:t&&null!=t.body?t.body:this.body,url:t&&null!=t.url?t.url:this.url,params:t&&this._mergeSearchParams(t.params||t.search),withCredentials:t&&null!=t.withCredentials?t.withCredentials:this.withCredentials,responseType:t&&null!=t.responseType?t.responseType:this.responseType})},e.prototype._mergeSearchParams=function(e){return e?e instanceof qu?e.clone():"string"==typeof e?new qu(e):this._parseParams(e):this.params},e.prototype._parseParams=function(e){var t=this;void 0===e&&(e={});var n=new qu;return Object.keys(e).forEach(function(r){var o=e[r];Array.isArray(o)?o.forEach(function(e){return t._appendParam(r,e,n)}):t._appendParam(r,o,n)}),n},e.prototype._appendParam=function(e,t,n){"string"!=typeof t&&(t=JSON.stringify(t)),n.append(e,t)},e}(),Xu=function(e){function t(){return e.call(this,{method:Iu.Get,headers:new Mu})||this}return o(t,e),t}(Qu),Yu=function(e){function t(t){var n=e.call(this)||this,r=t.url;n.url=t.url;var o,i=t.params||t.search;if(i&&(o="object"!=typeof i||i instanceof qu?i.toString():function(e){var t=new qu;return Object.keys(e).forEach(function(n){var r=e[n];r&&Array.isArray(r)?r.forEach(function(e){return t.append(n,e.toString())}):t.append(n,r.toString())}),t}(i).toString()).length>0){var s="?";-1!=n.url.indexOf("?")&&(s="&"==n.url[n.url.length-1]?"":"&"),n.url=r+s+o}return n._body=t.body,n.method=Vu(t.method),n.headers=new Mu(t.headers),n.contentType=n.detectContentType(),n.withCredentials=t.withCredentials,n.responseType=t.responseType,n}return o(t,e),t.prototype.detectContentType=function(){switch(this.headers.get("content-type")){case"application/json":return Ru.JSON;case"application/x-www-form-urlencoded":return Ru.FORM;case"multipart/form-data":return Ru.FORM_DATA;case"text/plain":case"text/html":return Ru.TEXT;case"application/octet-stream":return this._body instanceof nl?Ru.ARRAY_BUFFER:Ru.BLOB;default:return this.detectContentTypeFromBody()}},t.prototype.detectContentTypeFromBody=function(){return null==this._body?Ru.NONE:this._body instanceof qu?Ru.FORM:this._body instanceof el?Ru.FORM_DATA:this._body instanceof tl?Ru.BLOB:this._body instanceof nl?Ru.ARRAY_BUFFER:this._body&&"object"==typeof this._body?Ru.JSON:Ru.TEXT},t.prototype.getBody=function(){switch(this.contentType){case Ru.JSON:case Ru.FORM:return this.text();case Ru.FORM_DATA:return this._body;case Ru.TEXT:return this.text();case Ru.BLOB:return this.blob();case Ru.ARRAY_BUFFER:return this.arrayBuffer();default:return null}},t}(Uu),Ju=function(){},Ku="object"==typeof window?window:Ju,el=Ku.FormData||Ju,tl=Ku.Blob||Ju,nl=Ku.ArrayBuffer||Ju;function rl(e,t){return e.createConnection(t).response}function ol(e,t,n,r){return e.merge(new Qu(t?{method:t.method||n,url:t.url||r,search:t.search,params:t.params,headers:t.headers,body:t.body,withCredentials:t.withCredentials,responseType:t.responseType}:{method:n,url:r}))}var il=function(){function e(e,t){this._backend=e,this._defaultOptions=t}return e.prototype.request=function(e,t){var n;if("string"==typeof e)n=rl(this._backend,new Yu(ol(this._defaultOptions,t,Iu.Get,e)));else{if(!(e instanceof Yu))throw new Error("First argument must be a url string or Request instance.");n=rl(this._backend,e)}return n},e.prototype.get=function(e,t){return this.request(new Yu(ol(this._defaultOptions,t,Iu.Get,e)))},e.prototype.post=function(e,t,n){return this.request(new Yu(ol(this._defaultOptions.merge(new Qu({body:t})),n,Iu.Post,e)))},e.prototype.put=function(e,t,n){return this.request(new Yu(ol(this._defaultOptions.merge(new Qu({body:t})),n,Iu.Put,e)))},e.prototype.delete=function(e,t){return this.request(new Yu(ol(this._defaultOptions,t,Iu.Delete,e)))},e.prototype.patch=function(e,t,n){return this.request(new Yu(ol(this._defaultOptions.merge(new Qu({body:t})),n,Iu.Patch,e)))},e.prototype.head=function(e,t){return this.request(new Yu(ol(this._defaultOptions,t,Iu.Head,e)))},e.prototype.options=function(e,t){return this.request(new Yu(ol(this._defaultOptions,t,Iu.Options,e)))},e}();function sl(){return new Zu}function al(e,t){return new il(e,t)}var ul=function(){},ll=(n("5NFG"),function(){function e(e){this.nodeDraggableService=e,this.nodeMoved$=new B,this.nodeRemoved$=new B,this.nodeRenamed$=new B,this.nodeCreated$=new B,this.nodeSelected$=new B,this.nodeUnselected$=new B,this.nodeExpanded$=new B,this.nodeCollapsed$=new B,this.menuItemSelected$=new B,this.loadNextLevel$=new B,this.nodeChecked$=new B,this.nodeUnchecked$=new B,this.nodeIndetermined$=new B,this.controllers=new Map,this.nodeRemoved$.subscribe(function(e){return e.node.removeItselfFromParent()})}return e.prototype.unselectStream=function(e){return this.nodeSelected$.filter(function(t){return e!==t.node})},e.prototype.fireNodeRemoved=function(e){this.nodeRemoved$.next(new Bs(e,e.positionInParent))},e.prototype.fireNodeCreated=function(e){this.nodeCreated$.next(new qs(e))},e.prototype.fireNodeSelected=function(e){this.nodeSelected$.next(new Ls(e))},e.prototype.fireNodeUnselected=function(e){this.nodeUnselected$.next(new Vs(e))},e.prototype.fireNodeRenamed=function(e,t){this.nodeRenamed$.next(new Us(t,e,t.value))},e.prototype.fireNodeMoved=function(e,t){this.nodeMoved$.next(new Hs(e,t))},e.prototype.fireMenuItemSelected=function(e,t){this.menuItemSelected$.next(new Ws(e,t))},e.prototype.fireNodeSwitchFoldingType=function(e){e.isNodeExpanded()?(this.fireNodeExpanded(e),this.shouldFireLoadNextLevel(e)&&this.fireLoadNextLevel(e)):e.isNodeCollapsed()&&this.fireNodeCollapsed(e)},e.prototype.fireNodeExpanded=function(e){this.nodeExpanded$.next(new $s(e))},e.prototype.fireNodeCollapsed=function(e){this.nodeCollapsed$.next(new zs(e))},e.prototype.fireLoadNextLevel=function(e){this.loadNextLevel$.next(new Zs(e))},e.prototype.fireNodeChecked=function(e){this.nodeChecked$.next(new Gs(e))},e.prototype.fireNodeUnchecked=function(e){this.nodeUnchecked$.next(new Qs(e))},e.prototype.draggedStream=function(e,t){return this.nodeDraggableService.draggableNodeEvents$.filter(function(e){return e.target===t}).filter(function(t){return!t.captured.tree.hasChild(e)})},e.prototype.setController=function(e,t){this.controllers.set(e,t)},e.prototype.deleteController=function(e){this.controllers.has(e)&&this.controllers.delete(e)},e.prototype.getController=function(e){return this.controllers.has(e)?this.controllers.get(e):null},e.prototype.hasController=function(e){return this.controllers.has(e)},e.prototype.shouldFireLoadNextLevel=function(e){var t=e.node.emitLoadNextLevel&&!e.node.loadChildren&&!e.childrenAreBeingLoaded()&&ws(e.children);return t&&e.loadingChildrenRequested(),t},e.prototype.fireNodeIndetermined=function(e){this.nodeIndetermined$.next(new Xs(e))},e}()),cl=function(){function e(e){this.http=e,this.treeListUrl=window.location.href,this.headers=new Mu({"Content-Type":"application/json"}),this.options=new Qu({headers:this.headers})}return e.prototype.set_tree_state=function(e){var t=window.location.href.split("/");return this.http.post(t[0]+"//"+t[2]+"/api/indextree/set_expand",JSON.stringify({index_id:e})).toPromise().then(function(e){return e.json()}).catch()},e}(),dl=function(){function e(e,t,n,r){this.nodeMenuService=e,this.treeService=t,this.nodeElementRef=n,this.treeDefaultService=r,this.isSelected=!1,this.isRightMenuVisible=!1,this.isLeftMenuVisible=!1,this.isReadOnly=!1,this.subscriptions=[]}return e.prototype.ngAfterViewInit=function(){this.tree.checked&&!this.tree.firstCheckedFired&&(this.tree.firstCheckedFired=!0,this.treeService.fireNodeChecked(this.tree))},e.prototype.ngOnInit=function(){var e=this,t=Cs(this.tree,"node.id","");t&&(this.controller=new Ps(this),this.treeService.setController(t,this.controller)),this.settings=this.settings||new function(){this.rootIsVisible=!0,this.showCheckboxes=!1,this.enableCheckboxes=!0},this.isReadOnly=!Cs(this.settings,"enableCheckboxes",!0),this.tree.isRoot()&&!1===this.settings.rootIsVisible&&this.tree.disableCollapseOnInit(),this.subscriptions.push(this.nodeMenuService.hideMenuStream(this.nodeElementRef).subscribe(function(){e.isRightMenuVisible=!1,e.isLeftMenuVisible=!1})),this.subscriptions.push(this.treeService.unselectStream(this.tree).subscribe(function(){return e.isSelected=!1})),this.subscriptions.push(this.treeService.draggedStream(this.tree,this.nodeElementRef).subscribe(function(t){e.tree.hasSibling(t.captured.tree)?t.isMovedInto?e.moveNodeToThisTreeAndRemoveFromPreviousOne(t,e.tree):e.insertWithSibling(t.captured.tree,e.tree):e.tree.isBranch()&&t.isMovedInto?e.moveNodeToThisTreeAndRemoveFromPreviousOne(t,e.tree):e.moveNodeToParentTreeAndRemoveFromPreviousOne(t,e.tree)})),this.subscriptions.push(this.treeService.nodeChecked$.merge(this.treeService.nodeUnchecked$).filter(function(t){return e.eventContainsId(t)&&e.tree.hasChild(t.node)}).subscribe(function(t){return e.updateCheckboxState()}))},e.prototype.ngOnChanges=function(e){this.controller=new Ps(this)},e.prototype.ngOnDestroy=function(){Cs(this.tree,"node.id","")&&this.treeService.deleteController(this.tree.node.id),this.subscriptions.forEach(function(e){return e&&e.unsubscribe()})},e.prototype.swapWithSibling=function(e,t){t.swapWithSibling(e),this.treeService.fireNodeMoved(e,e.parent)},e.prototype.insertWithSibling=function(e,t){t.insertWithSibling(e),this.treeService.fireNodeMoved(e,e.parent)},e.prototype.moveNodeToThisTreeAndRemoveFromPreviousOne=function(e,t){this.treeService.fireNodeRemoved(e.captured.tree);var n=t.addChild(e.captured.tree);this.treeService.fireNodeMoved(n,e.captured.tree.parent)},e.prototype.moveNodeToParentTreeAndRemoveFromPreviousOne=function(e,t){this.treeService.fireNodeRemoved(e.captured.tree);var n=t.addSibling(e.captured.tree,t.positionInParent);this.treeService.fireNodeMoved(n,e.captured.tree.parent)},e.prototype.onNodeSelected=function(e){this.tree.selectionAllowed&&ys(e)&&(this.isSelected=!0,this.treeService.fireNodeSelected(this.tree))},e.prototype.onNodeUnselected=function(e){this.tree.selectionAllowed&&ys(e)&&(this.isSelected=!1,this.treeService.fireNodeUnselected(this.tree))},e.prototype.showRightMenu=function(e){this.tree.hasRightMenu()&&(function(e){return e.button===hs.Right}(e)&&(this.isRightMenuVisible=!this.isRightMenuVisible,this.nodeMenuService.hideMenuForAllNodesExcept(this.nodeElementRef)),e.preventDefault())},e.prototype.showLeftMenu=function(e){this.tree.hasLeftMenu()&&ys(e)&&(this.isLeftMenuVisible=!this.isLeftMenuVisible,this.nodeMenuService.hideMenuForAllNodesExcept(this.nodeElementRef),this.isLeftMenuVisible&&e.preventDefault())},e.prototype.onMenuItemSelected=function(e){switch(e.nodeMenuItemAction){case cs.NewTag:case cs.NewFolder:this.onNewSelected(e);break;case cs.Rename:this.onRenameSelected();break;case cs.Remove:this.onRemoveSelected();break;case cs.Custom:this.onCustomSelected(),this.treeService.fireMenuItemSelected(this.tree,e.nodeMenuItemSelected);break;default:throw new Error("Chosen menu item doesn't exist")}},e.prototype.onNewSelected=function(e){this.tree.createNode(e.nodeMenuItemAction===cs.NewFolder),this.isRightMenuVisible=!1,this.isLeftMenuVisible=!1},e.prototype.onRenameSelected=function(){this.tree.markAsBeingRenamed(),this.isRightMenuVisible=!1,this.isLeftMenuVisible=!1},e.prototype.onRemoveSelected=function(){this.treeService.deleteController(Cs(this.tree,"node.id","")),this.treeService.fireNodeRemoved(this.tree)},e.prototype.onCustomSelected=function(){this.isRightMenuVisible=!1,this.isLeftMenuVisible=!1},e.prototype.onSwitchFoldingType=function(){this.tree.switchFoldingType(),this.treeService.fireNodeSwitchFoldingType(this.tree),this.tree.id&&this.treeDefaultService.set_tree_state(this.tree.id.toString()).then()},e.prototype.applyNewValue=function(e){if((e.action===us.Cancel||this.tree.isNew())&&Ms.isValueEmpty(e.value))return this.treeService.fireNodeRemoved(this.tree);if(this.tree.isNew()&&(this.tree.value=e.value,this.treeService.fireNodeCreated(this.tree)),this.tree.isBeingRenamed()){var t=this.tree.value;this.tree.value=e.value,this.treeService.fireNodeRenamed(t,this.tree)}this.tree.markAsModified()},e.prototype.shouldShowInputForTreeValue=function(){return this.tree.isNew()||this.tree.isBeingRenamed()},e.prototype.isRootHidden=function(){return this.tree.isRoot()&&!this.settings.rootIsVisible},e.prototype.hasCustomMenu=function(){return this.tree.hasCustomMenu()},e.prototype.switchNodeCheckStatus=function(){this.tree.checked?this.onNodeUnchecked():this.onNodeChecked()},e.prototype.onNodeChecked=function(){this.checkboxElementRef&&(this.checkboxElementRef.nativeElement.indeterminate=!1,this.treeService.fireNodeChecked(this.tree),this.tree.checked=!0)},e.prototype.onNodeUnchecked=function(){this.checkboxElementRef&&(this.checkboxElementRef.nativeElement.indeterminate=!1,this.treeService.fireNodeUnchecked(this.tree),this.tree.checked=!1)},e.prototype.executeOnChildController=function(e){var t=this;this.tree.hasLoadedChildern()&&this.tree.children.forEach(function(n){var r=t.treeService.getController(n.id);ks(r)||e(r)})},e.prototype.updateCheckboxState=function(){},e.prototype.eventContainsId=function(e){return!!e.node.id||(console.warn('"Node with checkbox" feature requires a unique id assigned to every node, please consider to add it.'),!1)},e}(),pl=function(){function e(e,t){this.anElement=e,this.aTree=t}return e.prototype.canBeDroppedAt=function(e){return!this.sameAs(e)&&!this.contains(e)},e.prototype.contains=function(e){return this.element.nativeElement.contains(e.nativeElement)},e.prototype.sameAs=function(e){return this.element===e},Object.defineProperty(e.prototype,"element",{get:function(){return this.anElement},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tree",{get:function(){return this.aTree},enumerable:!0,configurable:!0}),e}(),fl=function(){function e(e,t,n){this.element=e,this.nodeDraggableService=t,this.renderer=n,this.disposersForDragListeners=[],this.nodeNativeElement=e.nativeElement}return e.prototype.ngOnInit=function(){this.tree.isStatic()||(this.renderer.setAttribute(this.nodeNativeElement,"draggable",this.tree.isRoot()?"false":"true"),this.disposersForDragListeners.push(this.renderer.listen(this.nodeNativeElement,"dragenter",this.handleDragEnter.bind(this))),this.disposersForDragListeners.push(this.renderer.listen(this.nodeNativeElement,"dragover",this.handleDragOver.bind(this))),this.disposersForDragListeners.push(this.renderer.listen(this.nodeNativeElement,"dragstart",this.handleDragStart.bind(this))),this.disposersForDragListeners.push(this.renderer.listen(this.nodeNativeElement,"dragleave",this.handleDragLeave.bind(this))),this.disposersForDragListeners.push(this.renderer.listen(this.nodeNativeElement,"drop",this.handleDrop.bind(this))),this.disposersForDragListeners.push(this.renderer.listen(this.nodeNativeElement,"dragend",this.handleDragEnd.bind(this))))},e.prototype.ngOnDestroy=function(){this.disposersForDragListeners.forEach(function(e){return e()})},e.prototype.handleDragStart=function(t){t.stopPropagation&&t.stopPropagation(),this.nodeDraggableService.captureNode(new pl(this.nodeDraggable,this.tree)),t.dataTransfer.setData("text",e.DATA_TRANSFER_STUB_DATA),t.dataTransfer.effectAllowed="move"},e.prototype.handleDragOver=function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"},e.prototype.handleDragEnter=function(e){e.preventDefault(),this.containsElementAt(e)&&this.nodeDraggableService.getCapturedNode().element!==this.nodeDraggable&&(e.offsetY0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?"&":"?")+o),r},e.prototype.handleError=function(e){return console.error("An error occurred",e),Promise.reject(e.message||e)},e}(),Vl=function(){function e(e,t){this.predicate=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new Fl(e,this.predicate,this.thisArg))},e}(),Fl=function(e){function t(t,n,r){e.call(this,t),this.predicate=n,this.thisArg=r,this.count=0}return o(t,e),t.prototype._next=function(e){var t;try{t=this.predicate.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}t&&this.destination.next(e)},t}(C);S.prototype.filter=function(e,t){return function(e,t){return function(n){return n.lift(new Vl(e,t))}}(e,t)(this)},S.of=I.of,S.prototype.merge=function(){for(var e=[],t=0;t=0;--t)if(this._accessors[t][1]===e)return void this._accessors.splice(t,1)},e.prototype.select=function(e){var t=this;this._accessors.forEach(function(n){t._isSameGroup(n,e)&&n[1]!==e&&n[1].fireUncheck(e.value)})},e.prototype._isSameGroup=function(e,t){return!!e[0].control&&e[0]._parent===t._control._parent&&e[1].name===t.name},e}(),Gl=function(){},Ql=function(){},Xl=function(e,t,n){return new Vi(Fi,[Hi],function(e){return function(e){for(var t={},n=0;n>>((3&t)<<3)&255;return o}}},"5NFG":function(e,t){},EVdn:function(e,t,n){var r;!function(t,n){"use strict";"object"==typeof e.exports?e.exports=t.document?n(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}:n(t)}("undefined"!=typeof window?window:this,function(n,o){"use strict";var i=[],s=Object.getPrototypeOf,a=i.slice,u=i.flat?function(e){return i.flat.call(e)}:function(e){return i.concat.apply([],e)},l=i.push,c=i.indexOf,d={},p=d.toString,f=d.hasOwnProperty,h=f.toString,y=h.call(Object),g={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},m=function(e){return null!=e&&e===e.window},b=n.document,w={type:!0,src:!0,nonce:!0,noModule:!0};function _(e,t,n){var r,o,i=(n=n||b).createElement("script");if(i.text=e,t)for(r in w)(o=t[r]||t.getAttribute&&t.getAttribute(r))&&i.setAttribute(r,o);n.head.appendChild(i).parentNode.removeChild(i)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?d[p.call(e)]||"object":typeof e}var C=function(e,t){return new C.fn.init(e,t)};function E(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!m(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}C.fn=C.prototype={jquery:"3.6.1",constructor:C,length:0,toArray:function(){return a.call(this)},get:function(e){return null==e?a.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=C.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return C.each(this,e)},map:function(e){return this.pushStack(C.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(a.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(C.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(C.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n+~]|"+L+")"+L+"*"),z=new RegExp(L+"|>"),W=new RegExp(H),Z=new RegExp("^"+V+"$"),G={ID:new RegExp("^#("+V+")"),CLASS:new RegExp("^\\.("+V+")"),TAG:new RegExp("^("+V+"|[*])"),ATTR:new RegExp("^"+F),PSEUDO:new RegExp("^"+H),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+j+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Q=/HTML$/i,X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,J=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+L+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,oe=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},ie=function(){p()},se=we(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{D.apply(I=M.call(_.childNodes),_.childNodes)}catch(e){D={apply:I.length?function(e,t){R.apply(e,M.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function ae(e,t,r,o){var i,a,l,c,d,h,v,m=t&&t.ownerDocument,_=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==_&&9!==_&&11!==_)return r;if(!o&&(p(t),t=t||f,y)){if(11!==_&&(d=K.exec(e)))if(i=d[1]){if(9===_){if(!(l=t.getElementById(i)))return r;if(l.id===i)return r.push(l),r}else if(m&&(l=m.getElementById(i))&&b(t,l)&&l.id===i)return r.push(l),r}else{if(d[2])return D.apply(r,t.getElementsByTagName(e)),r;if((i=d[3])&&n.getElementsByClassName&&t.getElementsByClassName)return D.apply(r,t.getElementsByClassName(i)),r}if(n.qsa&&!N[e+" "]&&(!g||!g.test(e))&&(1!==_||"object"!==t.nodeName.toLowerCase())){if(v=e,m=t,1===_&&(z.test(e)||$.test(e))){for((m=ee.test(e)&&ve(t.parentNode)||t)===t&&n.scope||((c=t.getAttribute("id"))?c=c.replace(re,oe):t.setAttribute("id",c=w)),a=(h=s(e)).length;a--;)h[a]=(c?"#"+c:":scope")+" "+be(h[a]);v=h.join(",")}try{return D.apply(r,m.querySelectorAll(v)),r}catch(t){N(e,!0)}finally{c===w&&t.removeAttribute("id")}}}return u(e.replace(q,"$1"),t,r,o)}function ue(){var e=[];return function t(n,o){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=o}}function le(e){return e[w]=!0,e}function ce(e){var t=f.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function de(e,t){for(var n=e.split("|"),o=n.length;o--;)r.attrHandle[n[o]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function he(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ye(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&se(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function ge(e){return le(function(t){return t=+t,le(function(n,r){for(var o,i=e([],n.length,t),s=i.length;s--;)n[o=i[s]]&&(n[o]=!(r[o]=n[o]))})})}function ve(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in n=ae.support={},i=ae.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!Q.test(e&&e.namespaceURI||t&&t.nodeName||"HTML")},p=ae.setDocument=function(e){var t,o,s=e?e.ownerDocument||e:_;return s!=f&&9===s.nodeType&&s.documentElement?(h=(f=s).documentElement,y=!i(f),_!=f&&(o=f.defaultView)&&o.top!==o&&(o.addEventListener?o.addEventListener("unload",ie,!1):o.attachEvent&&o.attachEvent("onunload",ie)),n.scope=ce(function(e){return h.appendChild(e).appendChild(f.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),n.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ce(function(e){return e.appendChild(f.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=J.test(f.getElementsByClassName),n.getById=ce(function(e){return h.appendChild(e).id=w,!f.getElementsByName||!f.getElementsByName(w).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&y){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&y){var n,r,o,i=t.getElementById(e);if(i){if((n=i.getAttributeNode("id"))&&n.value===e)return[i];for(o=t.getElementsByName(e),r=0;i=o[r++];)if((n=i.getAttributeNode("id"))&&n.value===e)return[i]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],o=0,i=t.getElementsByTagName(e);if("*"===e){for(;n=i[o++];)1===n.nodeType&&r.push(n);return r}return i},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&y)return t.getElementsByClassName(e)},v=[],g=[],(n.qsa=J.test(f.querySelectorAll))&&(ce(function(e){var t;h.appendChild(e).innerHTML=" ",e.querySelectorAll("[msallowcapture^='']").length&&g.push("[*^$]="+L+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||g.push("\\["+L+"*(?:value|"+j+")"),e.querySelectorAll("[id~="+w+"-]").length||g.push("~="),(t=f.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||g.push("\\["+L+"*name"+L+"*="+L+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||g.push(":checked"),e.querySelectorAll("a#"+w+"+*").length||g.push(".#.+[+~]"),e.querySelectorAll("\\\f"),g.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML=" ";var t=f.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&g.push("name"+L+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&g.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(n.matchesSelector=J.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ce(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",H)}),g=g.length&&new RegExp(g.join("|")),v=v.length&&new RegExp(v.join("|")),t=J.test(h.compareDocumentPosition),b=t||J.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},k=t?function(e,t){if(e===t)return d=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e==f||e.ownerDocument==_&&b(_,e)?-1:t==f||t.ownerDocument==_&&b(_,t)?1:c?P(c,e)-P(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return d=!0,0;var n,r=0,o=e.parentNode,i=t.parentNode,s=[e],a=[t];if(!o||!i)return e==f?-1:t==f?1:o?-1:i?1:c?P(c,e)-P(c,t):0;if(o===i)return pe(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;s[r]===a[r];)r++;return r?pe(s[r],a[r]):s[r]==_?-1:a[r]==_?1:0},f):f},ae.matches=function(e,t){return ae(e,null,null,t)},ae.matchesSelector=function(e,t){if(p(e),n.matchesSelector&&y&&!N[t+" "]&&(!v||!v.test(t))&&(!g||!g.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){N(t,!0)}return ae(t,f,null,[e]).length>0},ae.contains=function(e,t){return(e.ownerDocument||e)!=f&&p(e),b(e,t)},ae.attr=function(e,t){(e.ownerDocument||e)!=f&&p(e);var o=r.attrHandle[t.toLowerCase()],i=o&&A.call(r.attrHandle,t.toLowerCase())?o(e,t,!y):void 0;return void 0!==i?i:n.attributes||!y?e.getAttribute(t):(i=e.getAttributeNode(t))&&i.specified?i.value:null},ae.escape=function(e){return(e+"").replace(re,oe)},ae.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ae.uniqueSort=function(e){var t,r=[],o=0,i=0;if(d=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(k),d){for(;t=e[i++];)t===e[i]&&(o=r.push(i));for(;o--;)e.splice(r[o],1)}return c=null,e},o=ae.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=o(t);return n},(r=ae.selectors={cacheLength:50,createPseudo:le,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ae.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ae.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&W.test(n)&&(t=s(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+L+")"+e+"("+L+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var o=ae.attr(r,e);return null==o?"!="===t:!t||(o+="","="===t?o===n:"!="===t?o!==n:"^="===t?n&&0===o.indexOf(n):"*="===t?n&&o.indexOf(n)>-1:"$="===t?n&&o.slice(-n.length)===n:"~="===t?(" "+o.replace(B," ")+" ").indexOf(n)>-1:"|="===t&&(o===n||o.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,o){var i="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===o?function(e){return!!e.parentNode}:function(t,n,u){var l,c,d,p,f,h,y=i!==s?"nextSibling":"previousSibling",g=t.parentNode,v=a&&t.nodeName.toLowerCase(),m=!u&&!a,b=!1;if(g){if(i){for(;y;){for(p=t;p=p[y];)if(a?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=y="only"===e&&!h&&"nextSibling"}return!0}if(h=[s?g.firstChild:g.lastChild],s&&m){for(b=(f=(l=(c=(d=(p=g)[w]||(p[w]={}))[p.uniqueID]||(d[p.uniqueID]={}))[e]||[])[0]===x&&l[1])&&l[2],p=f&&g.childNodes[f];p=++f&&p&&p[y]||(b=f=0)||h.pop();)if(1===p.nodeType&&++b&&p===t){c[e]=[x,f,b];break}}else if(m&&(b=f=(l=(c=(d=(p=t)[w]||(p[w]={}))[p.uniqueID]||(d[p.uniqueID]={}))[e]||[])[0]===x&&l[1]),!1===b)for(;(p=++f&&p&&p[y]||(b=f=0)||h.pop())&&((a?p.nodeName.toLowerCase()!==v:1!==p.nodeType)||!++b||(m&&((c=(d=p[w]||(p[w]={}))[p.uniqueID]||(d[p.uniqueID]={}))[e]=[x,b]),p!==t)););return(b-=o)===r||b%r==0&&b/r>=0}}},PSEUDO:function(e,t){var n,o=r.pseudos[e]||r.setFilters[e.toLowerCase()]||ae.error("unsupported pseudo: "+e);return o[w]?o(t):o.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?le(function(e,n){for(var r,i=o(e,t),s=i.length;s--;)e[r=P(e,i[s])]=!(n[r]=i[s])}):function(e){return o(e,0,n)}):o}},pseudos:{not:le(function(e){var t=[],n=[],r=a(e.replace(q,"$1"));return r[w]?le(function(e,t,n,o){for(var i,s=r(e,null,o,[]),a=e.length;a--;)(i=s[a])&&(e[a]=!(t[a]=i))}):function(e,o,i){return t[0]=e,r(t,null,i,n),t[0]=null,!n.pop()}}),has:le(function(e){return function(t){return ae(e,t).length>0}}),contains:le(function(e){return e=e.replace(te,ne),function(t){return(t.textContent||o(t)).indexOf(e)>-1}}),lang:le(function(e){return Z.test(e||"")||ae.error("unsupported lang: "+e),e=e.replace(te,ne).toLowerCase(),function(t){var n;do{if(n=y?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ye(!1),disabled:ye(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return X.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ge(function(){return[0]}),last:ge(function(e,t){return[t-1]}),eq:ge(function(e,t,n){return[n<0?n+t:n]}),even:ge(function(e,t){for(var n=0;nt?t:n;--r>=0;)e.push(r);return e}),gt:ge(function(e,t,n){for(var r=n<0?n+t:n;++r1?function(t,n,r){for(var o=e.length;o--;)if(!e[o](t,n,r))return!1;return!0}:e[0]}function xe(e,t,n,r,o){for(var i,s=[],a=0,u=e.length,l=null!=t;a-1&&(i[l]=!(s[l]=d))}}else v=xe(v===s?v.splice(h,v.length):v),o?o(null,s,v,u):D.apply(s,v)})}function Ee(e){for(var t,n,o,i=e.length,s=r.relative[e[0].type],a=s||r.relative[" "],u=s?1:0,c=we(function(e){return e===t},a,!0),d=we(function(e){return P(t,e)>-1},a,!0),p=[function(e,n,r){var o=!s&&(r||n!==l)||((t=n).nodeType?c(e,n,r):d(e,n,r));return t=null,o}];u1&&_e(p),u>1&&be(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(q,"$1"),n,u0,o=e.length>0,i=function(i,s,a,u,c){var d,h,g,v=0,m="0",b=i&&[],w=[],_=l,C=i||o&&r.find.TAG("*",c),E=x+=null==_?1:Math.random()||.1,T=C.length;for(c&&(l=s==f||s||c);m!==T&&null!=(d=C[m]);m++){if(o&&d){for(h=0,s||d.ownerDocument==f||(p(d),a=!y);g=e[h++];)if(g(d,s||f,a)){u.push(d);break}c&&(x=E)}n&&((d=!g&&d)&&v--,i&&b.push(d))}if(v+=m,n&&m!==v){for(h=0;g=t[h++];)g(b,w,s,a);if(i){if(v>0)for(;m--;)b[m]||w[m]||(w[m]=O.call(u));w=xe(w)}D.apply(u,w),c&&!i&&w.length>0&&v+t.length>1&&ae.uniqueSort(u)}return c&&(x=E,l=_),b};return n?le(i):i}(i,o))).selector=e}return a},u=ae.select=function(e,t,n,o){var i,u,l,c,d,p="function"==typeof e&&e,f=!o&&s(e=p.selector||e);if(n=n||[],1===f.length){if((u=f[0]=f[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&y&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(te,ne),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}for(i=G.needsContext.test(e)?0:u.length;i--&&!r.relative[c=(l=u[i]).type];)if((d=r.find[c])&&(o=d(l.matches[0].replace(te,ne),ee.test(u[0].type)&&ve(t.parentNode)||t))){if(u.splice(i,1),!(e=o.length&&be(u)))return D.apply(n,o),n;break}}return(p||a(e,f))(o,t,!y,n,!t||ee.test(e)&&ve(t.parentNode)||t),n},n.sortStable=w.split("").sort(k).join("")===w,n.detectDuplicates=!!d,p(),n.sortDetached=ce(function(e){return 1&e.compareDocumentPosition(f.createElement("fieldset"))}),ce(function(e){return e.innerHTML=" ","#"===e.firstChild.getAttribute("href")})||de("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ce(function(e){return e.innerHTML=" ",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||de("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ce(function(e){return null==e.getAttribute("disabled")})||de(j,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),ae}(n);C.find=T,C.expr=T.selectors,C.expr[":"]=C.expr.pseudos,C.uniqueSort=C.unique=T.uniqueSort,C.text=T.getText,C.isXMLDoc=T.isXML,C.contains=T.contains,C.escapeSelector=T.escape;var S=function(e,t,n){for(var r=[],o=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(o&&C(e).is(n))break;r.push(e)}return r},N=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},k=C.expr.match.needsContext;function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var I=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function O(e,t,n){return v(t)?C.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?C.grep(e,function(e){return e===t!==n}):"string"!=typeof t?C.grep(e,function(e){return c.call(t,e)>-1!==n}):C.filter(t,e,n)}C.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?C.find.matchesSelector(r,e)?[r]:[]:C.find.matches(e,C.grep(t,function(e){return 1===e.nodeType}))},C.fn.extend({find:function(e){var t,n,r=this.length,o=this;if("string"!=typeof e)return this.pushStack(C(e).filter(function(){for(t=0;t1?C.uniqueSort(n):n},filter:function(e){return this.pushStack(O(this,e||[],!1))},not:function(e){return this.pushStack(O(this,e||[],!0))},is:function(e){return!!O(this,"string"==typeof e&&k.test(e)?C(e):e||[],!1).length}});var R,D=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(C.fn.init=function(e,t,n){var r,o;if(!e)return this;if(n=n||R,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:D.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(C.merge(this,C.parseHTML(r[1],(t=t instanceof C?t[0]:t)&&t.nodeType?t.ownerDocument||t:b,!0)),I.test(r[1])&&C.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(o=b.getElementById(r[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(C):C.makeArray(e,this)}).prototype=C.fn,R=C(b);var M=/^(?:parents|prev(?:Until|All))/,P={children:!0,contents:!0,next:!0,prev:!0};function j(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}C.fn.extend({has:function(e){var t=C(e,this),n=t.length;return this.filter(function(){for(var e=0;e-1:1===n.nodeType&&C.find.matchesSelector(n,e))){i.push(n);break}return this.pushStack(i.length>1?C.uniqueSort(i):i)},index:function(e){return e?"string"==typeof e?c.call(C(e),this[0]):c.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(C.uniqueSort(C.merge(this.get(),C(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),C.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return S(e,"parentNode")},parentsUntil:function(e,t,n){return S(e,"parentNode",n)},next:function(e){return j(e,"nextSibling")},prev:function(e){return j(e,"previousSibling")},nextAll:function(e){return S(e,"nextSibling")},prevAll:function(e){return S(e,"previousSibling")},nextUntil:function(e,t,n){return S(e,"nextSibling",n)},prevUntil:function(e,t,n){return S(e,"previousSibling",n)},siblings:function(e){return N((e.parentNode||{}).firstChild,e)},children:function(e){return N(e.firstChild)},contents:function(e){return null!=e.contentDocument&&s(e.contentDocument)?e.contentDocument:(A(e,"template")&&(e=e.content||e),C.merge([],e.childNodes))}},function(e,t){C.fn[e]=function(n,r){var o=C.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(o=C.filter(r,o)),this.length>1&&(P[e]||C.uniqueSort(o),M.test(e)&&o.reverse()),this.pushStack(o)}});var L=/[^\x20\t\r\n\f]+/g;function V(e){return e}function F(e){throw e}function H(e,t,n,r){var o;try{e&&v(o=e.promise)?o.call(e).done(t).fail(n):e&&v(o=e.then)?o.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}C.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return C.each(e.match(L)||[],function(e,n){t[n]=!0}),t}(e):C.extend({},e);var t,n,r,o,i=[],s=[],a=-1,u=function(){for(o=o||e.once,r=t=!0;s.length;a=-1)for(n=s.shift();++a-1;)i.splice(n,1),n<=a&&a--}),this},has:function(e){return e?C.inArray(e,i)>-1:i.length>0},empty:function(){return i&&(i=[]),this},disable:function(){return o=s=[],i=n="",this},disabled:function(){return!i},lock:function(){return o=s=[],n||t||(i=n=""),this},locked:function(){return!!o},fireWith:function(e,n){return o||(n=[e,(n=n||[]).slice?n.slice():n],s.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l},C.extend({Deferred:function(e){var t=[["notify","progress",C.Callbacks("memory"),C.Callbacks("memory"),2],["resolve","done",C.Callbacks("once memory"),C.Callbacks("once memory"),0,"resolved"],["reject","fail",C.Callbacks("once memory"),C.Callbacks("once memory"),1,"rejected"]],r="pending",o={state:function(){return r},always:function(){return i.done(arguments).fail(arguments),this},catch:function(e){return o.then(null,e)},pipe:function(){var e=arguments;return C.Deferred(function(n){C.each(t,function(t,r){var o=v(e[r[4]])&&e[r[4]];i[r[1]](function(){var e=o&&o.apply(this,arguments);e&&v(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[r[0]+"With"](this,o?[e]:arguments)})}),e=null}).promise()},then:function(e,r,o){var i=0;function s(e,t,r,o){return function(){var a=this,u=arguments,l=function(){var n,l;if(!(e=i&&(r!==F&&(a=void 0,u=[n]),t.rejectWith(a,u))}};e?c():(C.Deferred.getStackHook&&(c.stackTrace=C.Deferred.getStackHook()),n.setTimeout(c))}}return C.Deferred(function(n){t[0][3].add(s(0,n,v(o)?o:V,n.notifyWith)),t[1][3].add(s(0,n,v(e)?e:V)),t[2][3].add(s(0,n,v(r)?r:F))}).promise()},promise:function(e){return null!=e?C.extend(e,o):o}},i={};return C.each(t,function(e,n){var s=n[2],a=n[5];o[n[1]]=s.add,a&&s.add(function(){r=a},t[3-e][2].disable,t[3-e][3].disable,t[0][2].lock,t[0][3].lock),s.add(n[3].fire),i[n[0]]=function(){return i[n[0]+"With"](this===i?void 0:this,arguments),this},i[n[0]+"With"]=s.fireWith}),o.promise(i),e&&e.call(i,i),i},when:function(e){var t=arguments.length,n=t,r=Array(n),o=a.call(arguments),i=C.Deferred(),s=function(e){return function(n){r[e]=this,o[e]=arguments.length>1?a.call(arguments):n,--t||i.resolveWith(r,o)}};if(t<=1&&(H(e,i.done(s(n)).resolve,i.reject,!t),"pending"===i.state()||v(o[n]&&o[n].then)))return i.then();for(;n--;)H(o[n],s(n),i.reject);return i.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;C.Deferred.exceptionHook=function(e,t){n.console&&n.console.warn&&e&&B.test(e.name)&&n.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},C.readyException=function(e){n.setTimeout(function(){throw e})};var q=C.Deferred();function U(){b.removeEventListener("DOMContentLoaded",U),n.removeEventListener("load",U),C.ready()}C.fn.ready=function(e){return q.then(e).catch(function(e){C.readyException(e)}),this},C.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--C.readyWait:C.isReady)||(C.isReady=!0,!0!==e&&--C.readyWait>0||q.resolveWith(b,[C]))}}),C.ready.then=q.then,"complete"===b.readyState||"loading"!==b.readyState&&!b.documentElement.doScroll?n.setTimeout(C.ready):(b.addEventListener("DOMContentLoaded",U),n.addEventListener("load",U));var $=function(e,t,n,r,o,i,s){var a=0,u=e.length,l=null==n;if("object"===x(n))for(a in o=!0,n)$(e,t,a,n[a],!0,i,s);else if(void 0!==r&&(o=!0,v(r)||(s=!0),l&&(s?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(C(e),n)})),t))for(;a1,null,!0)},removeData:function(e){return this.each(function(){J.remove(this,e)})}}),C.extend({queue:function(e,t,n){var r;if(e)return r=Y.get(e,t=(t||"fx")+"queue"),n&&(!r||Array.isArray(n)?r=Y.access(e,t,C.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){var n=C.queue(e,t=t||"fx"),r=n.length,o=n.shift(),i=C._queueHooks(e,t);"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,function(){C.dequeue(e,t)},i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y.get(e,n)||Y.access(e,n,{empty:C.Callbacks("once memory").add(function(){Y.remove(e,[t+"queue",n])})})}}),C.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]*)/i,ve=/^$|^module$|\/(?:java|ecma)script/i;fe=b.createDocumentFragment().appendChild(b.createElement("div")),(he=b.createElement("input")).setAttribute("type","radio"),he.setAttribute("checked","checked"),he.setAttribute("name","t"),fe.appendChild(he),g.checkClone=fe.cloneNode(!0).cloneNode(!0).lastChild.checked,fe.innerHTML="",g.noCloneChecked=!!fe.cloneNode(!0).lastChild.defaultValue,fe.innerHTML=" ",g.option=!!fe.lastChild;var me={thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};function be(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?C.merge([e],n):n}function we(e,t){for(var n=0,r=e.length;n",""]);var _e=/<|?\w+;/;function xe(e,t,n,r,o){for(var i,s,a,u,l,c,d=t.createDocumentFragment(),p=[],f=0,h=e.length;f-1)o&&o.push(i);else if(l=se(i),s=be(d.appendChild(i),"script"),l&&we(s),n)for(c=0;i=s[c++];)ve.test(i.type||"")&&n.push(i);return d}var Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function Te(){return!1}function Se(e,t){return e===function(){try{return b.activeElement}catch(e){}}()==("focus"===t)}function Ne(e,t,n,r,o,i){var s,a;if("object"==typeof t){for(a in"string"!=typeof n&&(r=r||n,n=void 0),t)Ne(e,a,n,r,t[a],i);return e}if(null==r&&null==o?(o=n,r=n=void 0):null==o&&("string"==typeof n?(o=r,r=void 0):(o=r,r=n,n=void 0)),!1===o)o=Te;else if(!o)return e;return 1===i&&(s=o,(o=function(e){return C().off(e),s.apply(this,arguments)}).guid=s.guid||(s.guid=C.guid++)),e.each(function(){C.event.add(this,t,o,r,n)})}function ke(e,t,n){n?(Y.set(e,t,!1),C.event.add(e,t,{namespace:!1,handler:function(e){var r,o,i=Y.get(this,t);if(1&e.isTrigger&&this[t]){if(i.length)(C.event.special[t]||{}).delegateType&&e.stopPropagation();else if(i=a.call(arguments),Y.set(this,t,i),r=n(this,t),this[t](),i!==(o=Y.get(this,t))||r?Y.set(this,t,!1):o={},i!==o)return e.stopImmediatePropagation(),e.preventDefault(),o&&o.value}else i.length&&(Y.set(this,t,{value:C.event.trigger(C.extend(i[0],C.Event.prototype),i.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Y.get(e,t)&&C.event.add(e,t,Ee)}C.event={global:{},add:function(e,t,n,r,o){var i,s,a,u,l,c,d,p,f,h,y,g=Y.get(e);if(Q(e))for(n.handler&&(n=(i=n).handler,o=i.selector),o&&C.find.matchesSelector(ie,o),n.guid||(n.guid=C.guid++),(u=g.events)||(u=g.events=Object.create(null)),(s=g.handle)||(s=g.handle=function(t){return void 0!==C&&C.event.triggered!==t.type?C.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(L)||[""]).length;l--;)f=y=(a=Ce.exec(t[l])||[])[1],h=(a[2]||"").split(".").sort(),f&&(d=C.event.special[f]||{},d=C.event.special[f=(o?d.delegateType:d.bindType)||f]||{},c=C.extend({type:f,origType:y,data:r,handler:n,guid:n.guid,selector:o,needsContext:o&&C.expr.match.needsContext.test(o),namespace:h.join(".")},i),(p=u[f])||((p=u[f]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(e,r,h,s)||e.addEventListener&&e.addEventListener(f,s)),d.add&&(d.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),o?p.splice(p.delegateCount++,0,c):p.push(c),C.event.global[f]=!0)},remove:function(e,t,n,r,o){var i,s,a,u,l,c,d,p,f,h,y,g=Y.hasData(e)&&Y.get(e);if(g&&(u=g.events)){for(l=(t=(t||"").match(L)||[""]).length;l--;)if(f=y=(a=Ce.exec(t[l])||[])[1],h=(a[2]||"").split(".").sort(),f){for(d=C.event.special[f]||{},p=u[f=(r?d.delegateType:d.bindType)||f]||[],a=a[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=i=p.length;i--;)c=p[i],!o&&y!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(i,1),c.selector&&p.delegateCount--,d.remove&&d.remove.call(e,c));s&&!p.length&&(d.teardown&&!1!==d.teardown.call(e,h,g.handle)||C.removeEvent(e,f,g.handle),delete u[f])}else for(f in u)C.event.remove(e,f+t[l],n,r,!0);C.isEmptyObject(u)&&Y.remove(e,"handle events")}},dispatch:function(e){var t,n,r,o,i,s,a=new Array(arguments.length),u=C.event.fix(e),l=(Y.get(this,"events")||Object.create(null))[u.type]||[],c=C.event.special[u.type]||{};for(a[0]=u,t=1;t=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(i=[],s={},n=0;n-1:C.find(o,this,null,[l]).length),s[o]&&i.push(r);i.length&&a.push({elem:l,handlers:i})}return l=this,u\s*$/g;function Re(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&C(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Me(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,o,i,s,a;if(1===t.nodeType){if(Y.hasData(e)&&(a=Y.get(e).events))for(o in Y.remove(t,"handle events"),a)for(n=0,r=a[o].length;n1&&"string"==typeof h&&!g.checkClone&&Ie.test(h))return e.each(function(o){var i=e.eq(o);y&&(t[0]=h.call(this,o,i.html())),je(i,t,n,r)});if(p&&(i=(o=xe(t,e[0].ownerDocument,!1,e,r)).firstChild,1===o.childNodes.length&&(o=i),i||r)){for(a=(s=C.map(be(o,"script"),De)).length;d0&&we(s,!d&&be(e,"script")),c},cleanData:function(e){for(var t,n,r,o=C.event.special,i=0;void 0!==(n=e[i]);i++)if(Q(n)){if(t=n[Y.expando]){if(t.events)for(r in t.events)o[r]?C.event.remove(n,r):C.removeEvent(n,r,t.handle);n[Y.expando]=void 0}n[J.expando]&&(n[J.expando]=void 0)}}}),C.fn.extend({detach:function(e){return Le(this,e,!0)},remove:function(e){return Le(this,e)},text:function(e){return $(this,function(e){return void 0===e?C.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return je(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Re(this,e).appendChild(e)})},prepend:function(){return je(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Re(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return je(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return je(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(C.cleanData(be(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return C.clone(this,e,t)})},html:function(e){return $(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!me[(ge.exec(e)||["",""])[1].toLowerCase()]){e=C.htmlPrefilter(e);try{for(;n=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-i-u-a-.5))||0),u}function tt(e,t,n){var r=He(e),o=(!g.boxSizingReliable()||n)&&"border-box"===C.css(e,"boxSizing",!1,r),i=o,s=$e(e,t,r),a="offset"+t[0].toUpperCase()+t.slice(1);if(Ve.test(s)){if(!n)return s;s="auto"}return(!g.boxSizingReliable()&&o||!g.reliableTrDimensions()&&A(e,"tr")||"auto"===s||!parseFloat(s)&&"inline"===C.css(e,"display",!1,r))&&e.getClientRects().length&&(o="border-box"===C.css(e,"boxSizing",!1,r),(i=a in e)&&(s=e[a])),(s=parseFloat(s)||0)+et(e,t,n||(o?"border":"content"),i,r,s)+"px"}function nt(e,t,n,r,o){return new nt.prototype.init(e,t,n,r,o)}C.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=$e(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,i,s,a=G(t),u=Fe.test(t),l=e.style;if(u||(t=Qe(a)),s=C.cssHooks[t]||C.cssHooks[a],void 0===n)return s&&"get"in s&&void 0!==(o=s.get(e,!1,r))?o:l[t];"string"==(i=typeof n)&&(o=re.exec(n))&&o[1]&&(n=le(e,t,o),i="number"),null!=n&&n==n&&("number"!==i||u||(n+=o&&o[3]||(C.cssNumber[a]?"":"px")),g.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),s&&"set"in s&&void 0===(n=s.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var o,i,s,a=G(t);return Fe.test(t)||(t=Qe(a)),(s=C.cssHooks[t]||C.cssHooks[a])&&"get"in s&&(o=s.get(e,!0,n)),void 0===o&&(o=$e(e,t,r)),"normal"===o&&t in Je&&(o=Je[t]),""===n||n?(i=parseFloat(o),!0===n||isFinite(i)?i||0:o):o}}),C.each(["height","width"],function(e,t){C.cssHooks[t]={get:function(e,n,r){if(n)return!Xe.test(C.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?tt(e,t,r):Be(e,Ye,function(){return tt(e,t,r)})},set:function(e,n,r){var o,i=He(e),s=!g.scrollboxSize()&&"absolute"===i.position,a=(s||r)&&"border-box"===C.css(e,"boxSizing",!1,i),u=r?et(e,t,r,a,i):0;return a&&s&&(u-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(i[t])-et(e,t,"border",!1,i)-.5)),u&&(o=re.exec(n))&&"px"!==(o[3]||"px")&&(e.style[t]=n,n=C.css(e,t)),Ke(0,n,u)}}}),C.cssHooks.marginLeft=ze(g.reliableMarginLeft,function(e,t){if(t)return(parseFloat($e(e,"marginLeft"))||e.getBoundingClientRect().left-Be(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),C.each({margin:"",padding:"",border:"Width"},function(e,t){C.cssHooks[e+t]={expand:function(n){for(var r=0,o={},i="string"==typeof n?n.split(" "):[n];r<4;r++)o[e+oe[r]+t]=i[r]||i[r-2]||i[0];return o}},"margin"!==e&&(C.cssHooks[e+t].set=Ke)}),C.fn.extend({css:function(e,t){return $(this,function(e,t,n){var r,o,i={},s=0;if(Array.isArray(t)){for(r=He(e),o=t.length;s1)}}),C.Tween=nt,(nt.prototype={constructor:nt,init:function(e,t,n,r,o,i){this.elem=e,this.prop=n,this.easing=o||C.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=i||(C.cssNumber[n]?"":"px")},cur:function(){var e=nt.propHooks[this.prop];return e&&e.get?e.get(this):nt.propHooks._default.get(this)},run:function(e){var t,n=nt.propHooks[this.prop];return this.pos=t=this.options.duration?C.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):nt.propHooks._default.set(this),this}}).init.prototype=nt.prototype,(nt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=C.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){C.fx.step[e.prop]?C.fx.step[e.prop](e):1!==e.elem.nodeType||!C.cssHooks[e.prop]&&null==e.elem.style[Qe(e.prop)]?e.elem[e.prop]=e.now:C.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=nt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},C.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},C.fx=nt.prototype.init,C.fx.step={};var rt,ot,it=/^(?:toggle|show|hide)$/,st=/queueHooks$/;function at(){ot&&(!1===b.hidden&&n.requestAnimationFrame?n.requestAnimationFrame(at):n.setTimeout(at,C.fx.interval),C.fx.tick())}function ut(){return n.setTimeout(function(){rt=void 0}),rt=Date.now()}function lt(e,t){var n,r=0,o={height:e};for(t=t?1:0;r<4;r+=2-t)o["margin"+(n=oe[r])]=o["padding"+n]=e;return t&&(o.opacity=o.width=e),o}function ct(e,t,n){for(var r,o=(dt.tweeners[t]||[]).concat(dt.tweeners["*"]),i=0,s=o.length;i1)},removeAttr:function(e){return this.each(function(){C.removeAttr(this,e)})}}),C.extend({attr:function(e,t,n){var r,o,i=e.nodeType;if(3!==i&&8!==i&&2!==i)return void 0===e.getAttribute?C.prop(e,t,n):(1===i&&C.isXMLDoc(e)||(o=C.attrHooks[t.toLowerCase()]||(C.expr.match.bool.test(t)?pt:void 0)),void 0!==n?null===n?void C.removeAttr(e,t):o&&"set"in o&&void 0!==(r=o.set(e,n,t))?r:(e.setAttribute(t,n+""),n):o&&"get"in o&&null!==(r=o.get(e,t))?r:null==(r=C.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!g.radioValue&&"radio"===t&&A(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,o=t&&t.match(L);if(o&&1===e.nodeType)for(;n=o[r++];)e.removeAttribute(n)}}),pt={set:function(e,t,n){return!1===t?C.removeAttr(e,n):e.setAttribute(n,n),n}},C.each(C.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ft[t]||C.find.attr;ft[t]=function(e,t,r){var o,i,s=t.toLowerCase();return r||(i=ft[s],ft[s]=o,o=null!=n(e,t,r)?s:null,ft[s]=i),o}});var ht=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;function gt(e){return(e.match(L)||[]).join(" ")}function vt(e){return e.getAttribute&&e.getAttribute("class")||""}function mt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(L)||[]}C.fn.extend({prop:function(e,t){return $(this,C.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[C.propFix[e]||e]})}}),C.extend({prop:function(e,t,n){var r,o,i=e.nodeType;if(3!==i&&8!==i&&2!==i)return 1===i&&C.isXMLDoc(e)||(o=C.propHooks[t=C.propFix[t]||t]),void 0!==n?o&&"set"in o&&void 0!==(r=o.set(e,n,t))?r:e[t]=n:o&&"get"in o&&null!==(r=o.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=C.find.attr(e,"tabindex");return t?parseInt(t,10):ht.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),g.optSelected||(C.propHooks.selected={get:function(e){return null},set:function(e){}}),C.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){C.propFix[this.toLowerCase()]=this}),C.fn.extend({addClass:function(e){var t,n,r,o,i,s;return v(e)?this.each(function(t){C(this).addClass(e.call(this,t,vt(this)))}):(t=mt(e)).length?this.each(function(){if(r=vt(this),n=1===this.nodeType&&" "+gt(r)+" "){for(i=0;i-1;)n=n.replace(" "+o+" "," ");s=gt(n),r!==s&&this.setAttribute("class",s)}}):this:this.attr("class","")},toggleClass:function(e,t){var n,r,o,i,s=typeof e,a="string"===s||Array.isArray(e);return v(e)?this.each(function(n){C(this).toggleClass(e.call(this,n,vt(this),t),t)}):"boolean"==typeof t&&a?t?this.addClass(e):this.removeClass(e):(n=mt(e),this.each(function(){if(a)for(i=C(this),o=0;o-1)return!0;return!1}});var bt=/\r/g;C.fn.extend({val:function(e){var t,n,r,o=this[0];return arguments.length?(r=v(e),this.each(function(n){var o;1===this.nodeType&&(null==(o=r?e.call(this,n,C(this).val()):e)?o="":"number"==typeof o?o+="":Array.isArray(o)&&(o=C.map(o,function(e){return null==e?"":e+""})),(t=C.valHooks[this.type]||C.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,o,"value")||(this.value=o))})):o?(t=C.valHooks[o.type]||C.valHooks[o.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(o,"value"))?n:"string"==typeof(n=o.value)?n.replace(bt,""):null==n?"":n:void 0}}),C.extend({valHooks:{option:{get:function(e){var t=C.find.attr(e,"value");return null!=t?t:gt(C.text(e))}},select:{get:function(e){var t,n,r,o=e.options,i=e.selectedIndex,s="select-one"===e.type,a=s?null:[],u=s?i+1:o.length;for(r=i<0?u:s?i:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),i}}}}),C.each(["radio","checkbox"],function(){C.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=C.inArray(C(e).val(),t)>-1}},g.checkOn||(C.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),g.focusin="onfocusin"in n;var wt=/^(?:focusinfocus|focusoutblur)$/,_t=function(e){e.stopPropagation()};C.extend(C.event,{trigger:function(e,t,r,o){var i,s,a,u,l,c,d,p,h=[r||b],y=f.call(e,"type")?e.type:e,g=f.call(e,"namespace")?e.namespace.split("."):[];if(s=p=a=r=r||b,3!==r.nodeType&&8!==r.nodeType&&!wt.test(y+C.event.triggered)&&(y.indexOf(".")>-1&&(y=(g=y.split(".")).shift(),g.sort()),l=y.indexOf(":")<0&&"on"+y,(e=e[C.expando]?e:new C.Event(y,"object"==typeof e&&e)).isTrigger=o?2:3,e.namespace=g.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=r),t=null==t?[e]:C.makeArray(t,[e]),d=C.event.special[y]||{},o||!d.trigger||!1!==d.trigger.apply(r,t))){if(!o&&!d.noBubble&&!m(r)){for(wt.test((u=d.delegateType||y)+y)||(s=s.parentNode);s;s=s.parentNode)h.push(s),a=s;a===(r.ownerDocument||b)&&h.push(a.defaultView||a.parentWindow||n)}for(i=0;(s=h[i++])&&!e.isPropagationStopped();)p=s,e.type=i>1?u:d.bindType||y,(c=(Y.get(s,"events")||Object.create(null))[e.type]&&Y.get(s,"handle"))&&c.apply(s,t),(c=l&&s[l])&&c.apply&&Q(s)&&(e.result=c.apply(s,t),!1===e.result&&e.preventDefault());return e.type=y,o||e.isDefaultPrevented()||d._default&&!1!==d._default.apply(h.pop(),t)||!Q(r)||l&&v(r[y])&&!m(r)&&((a=r[l])&&(r[l]=null),C.event.triggered=y,e.isPropagationStopped()&&p.addEventListener(y,_t),r[y](),e.isPropagationStopped()&&p.removeEventListener(y,_t),C.event.triggered=void 0,a&&(r[l]=a)),e.result}},simulate:function(e,t,n){var r=C.extend(new C.Event,n,{type:e,isSimulated:!0});C.event.trigger(r,null,t)}}),C.fn.extend({trigger:function(e,t){return this.each(function(){C.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return C.event.trigger(e,t,n,!0)}}),g.focusin||C.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){C.event.simulate(t,e.target,C.event.fix(e))};C.event.special[t]={setup:function(){var r=this.ownerDocument||this.document||this,o=Y.access(r,t);o||r.addEventListener(e,n,!0),Y.access(r,t,(o||0)+1)},teardown:function(){var r=this.ownerDocument||this.document||this,o=Y.access(r,t)-1;o?Y.access(r,t,o):(r.removeEventListener(e,n,!0),Y.remove(r,t))}}});var xt=n.location,Ct={guid:Date.now()},Et=/\?/;C.parseXML=function(e){var t,r;if(!e||"string"!=typeof e)return null;try{t=(new n.DOMParser).parseFromString(e,"text/xml")}catch(e){}return r=t&&t.getElementsByTagName("parsererror")[0],t&&!r||C.error("Invalid XML: "+(r?C.map(r.childNodes,function(e){return e.textContent}).join("\n"):e)),t};var Tt=/\[\]$/,St=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,kt=/^(?:input|select|textarea|keygen)/i;function At(e,t,n,r){var o;if(Array.isArray(t))C.each(t,function(t,o){n||Tt.test(e)?r(e,o):At(e+"["+("object"==typeof o&&null!=o?t:"")+"]",o,n,r)});else if(n||"object"!==x(t))r(e,t);else for(o in t)At(e+"["+o+"]",t[o],n,r)}C.param=function(e,t){var n,r=[],o=function(e,t){var n=v(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!C.isPlainObject(e))C.each(e,function(){o(this.name,this.value)});else for(n in e)At(n,e[n],t,o);return r.join("&")},C.fn.extend({serialize:function(){return C.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=C.prop(this,"elements");return e?C.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!C(this).is(":disabled")&&kt.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!ye.test(e))}).map(function(e,t){var n=C(this).val();return null==n?null:Array.isArray(n)?C.map(n,function(e){return{name:t.name,value:e.replace(St,"\r\n")}}):{name:t.name,value:n.replace(St,"\r\n")}}).get()}});var It=/%20/g,Ot=/#.*$/,Rt=/([?&])_=[^&]*/,Dt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Mt=/^(?:GET|HEAD)$/,Pt=/^\/\//,jt={},Lt={},Vt="*/".concat("*"),Ft=b.createElement("a");function Ht(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o=0,i=t.toLowerCase().match(L)||[];if(v(n))for(;r=i[o++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function Bt(e,t,n,r){var o={},i=e===Lt;function s(a){var u;return o[a]=!0,C.each(e[a]||[],function(e,a){var l=a(t,n,r);return"string"!=typeof l||i||o[l]?i?!(u=l):void 0:(t.dataTypes.unshift(l),s(l),!1)}),u}return s(t.dataTypes[0])||!o["*"]&&s("*")}function qt(e,t){var n,r,o=C.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((o[n]?e:r||(r={}))[n]=t[n]);return r&&C.extend(!0,e,r),e}Ft.href=xt.href,C.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:xt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(xt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Vt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":C.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?qt(qt(e,C.ajaxSettings),t):qt(C.ajaxSettings,e)},ajaxPrefilter:Ht(jt),ajaxTransport:Ht(Lt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0);var r,o,i,s,a,u,l,c,d,p,f=C.ajaxSetup({},t=t||{}),h=f.context||f,y=f.context&&(h.nodeType||h.jquery)?C(h):C.event,g=C.Deferred(),v=C.Callbacks("once memory"),m=f.statusCode||{},w={},_={},x="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(l){if(!s)for(s={};t=Dt.exec(i);)s[t[1].toLowerCase()+" "]=(s[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=s[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return l?i:null},setRequestHeader:function(e,t){return null==l&&(e=_[e.toLowerCase()]=_[e.toLowerCase()]||e,w[e]=t),this},overrideMimeType:function(e){return null==l&&(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(l)E.always(e[E.status]);else for(t in e)m[t]=[m[t],e[t]];return this},abort:function(e){var t=e||x;return r&&r.abort(t),T(0,t),this}};if(g.promise(E),f.url=((e||f.url||xt.href)+"").replace(Pt,xt.protocol+"//"),f.type=t.method||t.type||f.method||f.type,f.dataTypes=(f.dataType||"*").toLowerCase().match(L)||[""],null==f.crossDomain){u=b.createElement("a");try{u.href=f.url,u.href=u.href,f.crossDomain=Ft.protocol+"//"+Ft.host!=u.protocol+"//"+u.host}catch(e){f.crossDomain=!0}}if(f.data&&f.processData&&"string"!=typeof f.data&&(f.data=C.param(f.data,f.traditional)),Bt(jt,f,t,E),l)return E;for(d in(c=C.event&&f.global)&&0==C.active++&&C.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!Mt.test(f.type),o=f.url.replace(Ot,""),f.hasContent?f.data&&f.processData&&0===(f.contentType||"").indexOf("application/x-www-form-urlencoded")&&(f.data=f.data.replace(It,"+")):(p=f.url.slice(o.length),f.data&&(f.processData||"string"==typeof f.data)&&(o+=(Et.test(o)?"&":"?")+f.data,delete f.data),!1===f.cache&&(o=o.replace(Rt,"$1"),p=(Et.test(o)?"&":"?")+"_="+Ct.guid+++p),f.url=o+p),f.ifModified&&(C.lastModified[o]&&E.setRequestHeader("If-Modified-Since",C.lastModified[o]),C.etag[o]&&E.setRequestHeader("If-None-Match",C.etag[o])),(f.data&&f.hasContent&&!1!==f.contentType||t.contentType)&&E.setRequestHeader("Content-Type",f.contentType),E.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+Vt+"; q=0.01":""):f.accepts["*"]),f.headers)E.setRequestHeader(d,f.headers[d]);if(f.beforeSend&&(!1===f.beforeSend.call(h,E,f)||l))return E.abort();if(x="abort",v.add(f.complete),E.done(f.success),E.fail(f.error),r=Bt(Lt,f,t,E)){if(E.readyState=1,c&&y.trigger("ajaxSend",[E,f]),l)return E;f.async&&f.timeout>0&&(a=n.setTimeout(function(){E.abort("timeout")},f.timeout));try{l=!1,r.send(w,T)}catch(e){if(l)throw e;T(-1,e)}}else T(-1,"No Transport");function T(e,t,s,u){var d,p,b,w,_,x=t;l||(l=!0,a&&n.clearTimeout(a),r=void 0,i=u||"",E.readyState=e>0?4:0,d=e>=200&&e<300||304===e,s&&(w=function(e,t,n){for(var r,o,i,s,a=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(o in a)if(a[o]&&a[o].test(r)){u.unshift(o);break}if(u[0]in n)i=u[0];else{for(o in n){if(!u[0]||e.converters[o+" "+u[0]]){i=o;break}s||(s=o)}i=i||s}if(i)return i!==u[0]&&u.unshift(i),n[i]}(f,E,s)),!d&&C.inArray("script",f.dataTypes)>-1&&C.inArray("json",f.dataTypes)<0&&(f.converters["text script"]=function(){}),w=function(e,t,n,r){var o,i,s,a,u,l={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)l[s.toLowerCase()]=e.converters[s];for(i=c.shift();i;)if(e.responseFields[i]&&(n[e.responseFields[i]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=i,i=c.shift())if("*"===i)i=u;else if("*"!==u&&u!==i){if(!(s=l[u+" "+i]||l["* "+i]))for(o in l)if((a=o.split(" "))[1]===i&&(s=l[u+" "+a[0]]||l["* "+a[0]])){!0===s?s=l[o]:!0!==l[o]&&(i=a[0],c.unshift(a[1]));break}if(!0!==s)if(s&&e.throws)t=s(t);else try{t=s(t)}catch(e){return{state:"parsererror",error:s?e:"No conversion from "+u+" to "+i}}}return{state:"success",data:t}}(f,w,E,d),d?(f.ifModified&&((_=E.getResponseHeader("Last-Modified"))&&(C.lastModified[o]=_),(_=E.getResponseHeader("etag"))&&(C.etag[o]=_)),204===e||"HEAD"===f.type?x="nocontent":304===e?x="notmodified":(x=w.state,p=w.data,d=!(b=w.error))):(b=x,!e&&x||(x="error",e<0&&(e=0))),E.status=e,E.statusText=(t||x)+"",d?g.resolveWith(h,[p,x,E]):g.rejectWith(h,[E,x,b]),E.statusCode(m),m=void 0,c&&y.trigger(d?"ajaxSuccess":"ajaxError",[E,f,d?p:b]),v.fireWith(h,[E,x]),c&&(y.trigger("ajaxComplete",[E,f]),--C.active||C.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return C.get(e,t,n,"json")},getScript:function(e,t){return C.get(e,void 0,t,"script")}}),C.each(["get","post"],function(e,t){C[t]=function(e,n,r,o){return v(n)&&(o=o||r,r=n,n=void 0),C.ajax(C.extend({url:e,type:t,dataType:o,data:n,success:r},C.isPlainObject(e)&&e))}}),C.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),C._evalUrl=function(e,t,n){return C.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){C.globalEval(e,t,n)}})},C.fn.extend({wrapAll:function(e){var t;return this[0]&&(v(e)&&(e=e.call(this[0])),t=C(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return v(e)?this.each(function(t){C(this).wrapInner(e.call(this,t))}):this.each(function(){var t=C(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v(e);return this.each(function(n){C(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){C(this).replaceWith(this.childNodes)}),this}}),C.expr.pseudos.hidden=function(e){return!C.expr.pseudos.visible(e)},C.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},C.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(e){}};var Ut={0:200,1223:204},$t=C.ajaxSettings.xhr();g.cors=!!$t&&"withCredentials"in $t,g.ajax=$t=!!$t,C.ajaxTransport(function(e){var t,r;if(g.cors||$t&&!e.crossDomain)return{send:function(o,i){var s,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(s in e.xhrFields)a[s]=e.xhrFields[s];for(s in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest"),o)a.setRequestHeader(s,o[s]);t=function(e){return function(){t&&(t=r=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,"abort"===e?a.abort():"error"===e?"number"!=typeof a.status?i(0,"error"):i(a.status,a.statusText):i(Ut[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=t(),r=a.onerror=a.ontimeout=t("error"),void 0!==a.onabort?a.onabort=r:a.onreadystatechange=function(){4===a.readyState&&n.setTimeout(function(){t&&r()})},t=t("abort");try{a.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}}),C.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),C.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return C.globalEval(e),e}}}),C.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),C.ajaxTransport("script",function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(r,o){t=C("