PageSourceSearch

https://studyindenmark.dk/static/js/plone-volto-components-manage-…anels-Relations-Relations.63d212e9.chunk.js

js studyindenmark.dk collected 2026-10-02 04:10:54 UTC 17,144 bytes, 2 lines download raw bytes

1(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[6296],{38860:(e,t,a)=>{var l=a(76392),n=a(54864);e.exports=function(e){return n(l(e).toLowerCase())}},61920:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>se});var l=a(11504),n=a(22668),o=a.n(n),s=a(44680),r=a(97104),i=a(25384),c=a(30318),u=a(900),d=a(29560),p=a(1328),v=a(61228),m=a(10412),g=a(46024),h=a(56368),f=a(32856),b=a(35080),_=a(3940),y=a(47968),k=a(38860),S=a.n(k),N=a(30900),w=a(39320),M=a(83184),C=a(95016),R=a(66540),D=a(43972),x=a(94464),U=a(35976),I=a(24448),P=a(78988),E=a(1552),T=a(16773),F=a(41080);var O=a(76040),B=a(36308),j=a(10892),q=a.n(j),$=a(65080),L=a(31280),A=a(79376),G=l.createElement;const Y=({relationtype:e,query_source:t,query_target:a,potential_sources_path:n,potential_targets_path:o})=>{var r,i;const c=(0,u.c)(),p=(0,s.useDispatch)(),m=(0,s.useSelector)((e=>{var t,a;return(null===(t=e.relations)||void 0===t||null===(a=t.stats)||void 0===a?void 0:a.data)||null}));let g=(0,s.useSelector)((t=>{var a,l,n,o;return(null===(a=t.relations)||void 0===a||null===(l=a.relations)||void 0===l||null===(n=l.data)||void 0===n||null===(o=n[e])||void 0===o?void 0:o.items)||[]})),f=(0,s.useSelector)((e=>{var t;return(null===(t=e.search.subrequests.potential_targets)||void 0===t?void 0:t.items)||[]})),b=(0,s.useSelector)((e=>{var t;return(null===(t=e.search.subrequests.potential_sources)||void 0===t?void 0:t.items)||[]}));const _=(0,s.useSelector)((t=>{var a,l,n,o;return(null===(a=t.relations)||void 0===a||null===(l=a.relations)||void 0===l||null===(n=l.data)||void 0===n||null===(o=n[e])||void 0===o?void 0:o.staticCatalogVocabularyQuery)||{}})),y=(0,s.useSelector)((t=>{var a,l,n,o;return!0!==(null===(a=t.relations)||void 0===a||null===(l=a.relations)||void 0===l||null===(n=l.data)||void 0===n||null===(o=n[e])||void 0===o?void 0:o.readonly)}));let k={};g.map((e=>(k[e.source.UID]?k[e.source.UID].targets.push(e.target):k[e.source.UID]={source:e.source,targets:[e.target]},k)));let S=g.map((e=>({value:e.target.UID,label:e.target.title,url:e.target["@id"],review_state:e.target.review_state,uid:e.target.UID})));S=q()(S,(function(e){return e.value}));const N=f.map((e=>({value:e.UID,label:e.title,url:e["@id"],review_state:e.review_state,uid:e.UID})));S=""===t&&""===a&&""!==n&&""!==o?N:[...S,...N],S=q()(S,(function(e){return e.value})),S.sort((function(e,t){var a=e.label.toUpperCase(),l=t.label.toUpperCase();return a<l?-1:a>l?1:0}));let M=Object.keys(k).map((e=>({value:e,label:k[e].source.title,targets:k[e].targets.map((e=>e.UID)),url:k[e].source["@id"],review_state:k[e].source.review_state})));const C=b.map((e=>{var t,a;return{value:e.UID,label:e.title,targets:(null===(t=k[e.UID])||void 0===t||null===(a=t.targets)||void 0===a?void 0:a.map((e=>e.UID)))||[],url:e["@id"],review_state:e.review_state}}));function R(){p((0,T.yY)(e,!1,null,null,null,t?t.startsWith("/")?t:`${t}*`:null,a?a.startsWith("/")?a:`${a}*`:null))}M=""===t&&""===a&&""!==n&&""!==o?C:[...M,...C],M=q()(M,(function(e){return e.value})),M.sort((function(e,t){var a=e.label.toUpperCase(),l=t.label.toUpperCase();return a<l?-1:a>l?1:0})),(0,l.useEffect)((()=>{(null===m||void 0===m?void 0:m.stats[e])<=1e3?p((0,T.yY)(e)):p((0,T.yY)(e,!1,null,null,null,t?t.startsWith("/")?t:`${t}*`:null,a?a.startsWith("/")?a:`${a}*`:null))}),[p,m,e,t,a]),(0,B.cp)((()=>{p("/"!==o&&""!==o?(0,A.M)(o,(0,O.c)({SearchableText:a,metadata_fields:["UID"],sort_on:"sortable_title"},_),"potential_targets"):(0,A.k)("potential_targets")),p("/"!==n&&""!==n?(0,A.M)(n,{SearchableText:t,metadata_fields:["UID"],sort_on:"sortable_title"},"potential_sources"):(0,A.k)("potential_sources"))}),[p,o,n,_,t,a]);return G(l.Fragment,null,S.length<=40&&M.length<=40&S.length>0&&M.length>0?G("div",{className:"administration_matrix"},G("div",{className:"label-options"},G("div",{className:"target-labels"},G("div",null),G("div",null,null===(r=S)||void 0===r?void 0:r.map((e=>G("div",{className:"label-options-label inclined",id:`label-options-label-${e.value}`,key:e.value},G("div",null,G(L.cp,{href:e.url,className:"published"!==e.review_state?"not-published":"",target:"_blank"},G("span",{className:"label",title:e.label},e.label.length>30?e.label.slice(0,27)+"...":e.label)))))))),G("div",{className:"listing-row selectall",key:"selectall"},G("div",{className:"listing-item"},G("div",null),G("div",{className:"matrix_options"},"isReferencing"!==e&&"iterate-working-copy"!==e&&y?null===(i=S)||void 0===i?void 0:i.map((t=>G("div",{key:t.value,title:c.formatMessage(h.c.createOrDeleteRelationsToTarget)+` '${t.label}'`},G($.c,{className:"toggle-target",defaultChecked:!1,onChange:(a,{checked:l})=>((t,a,l)=>{let n=[];a.forEach((a=>{n.push({source:a,target:t,relation:e})})),p(l?(0,T.Mh)(n):(0,T.eu)(n)).then((e=>{R()})).then((()=>{w.toast.success(G(E.c,{success:!0,title:c.formatMessage(h.c.success),content:c.formatMessage(h.c.relationsUpdated)}))}))})(t.value,M.map((e=>e.value)),l)})))):G(d.c,{id:"Read only for this type of relation.",defaultMessage:"Read only for this type of relation."}))))),G("div",{className:"items",key:"items"},G(l.Fragment,null,!y&&G(v.c,{warning:!0},G(d.c,{id:"Relations are editable with plone.api >= 2.0.3.",defaultMessage:"Relations are editable with plone.api >= 2.0.3."})),M.map((t=>{var a;
1return G("div",{className:"listing-row",key:t.id,id:`source-row-${t.value}`},G("div",{className:"listing-item",key:t["@id"]},G("div",null,G("span",{title:t.label,className:"item-title"},G(L.cp,{href:t.url,className:"published"!==t.review_state?"not-published":"",target:"_blank"},t.label.length>25?t.label.slice(0,22)+"...":t.label))),G("div",{className:"matrix_options"},null===(a=S)||void 0===a?void 0:a.map((a=>G(l.Fragment,{key:a.value},G($.c,{className:`checkbox_${a.value}`,key:a.value,title:a.title,disabled:"isReferencing"===e||"iterate-working-copy"===e||!y,checked:t.targets.includes(a.value),onChange:(l,{checked:n})=>{((e,t,a)=>{const l=[{source:t.y,target:t.x,relation:e}];p(a?(0,T.Mh)(l):(0,T.eu)(l)).then((e=>{R()})).then((()=>{w.toast.success(G(E.c,{success:!0,title:c.formatMessage(h.c.success),content:c.formatMessage(h.c.relationsUpdated)}))}))})(e,{x:a.value,y:t.value},n)}})))))))}))))):G("div",{className:"administration_matrix"},S.length>40||M.length>40?G(d.c,{id:"narrowDownRelations",defaultMessage:"Found {sources} sources and {targets} targets. Narrow down to {max}!",values:{sources:M.length,targets:S.length,max:40}}):G("div",null,t||a?c.formatMessage(h.c.norelationfound):c.formatMessage(h.c.toomanyrelationsfound))))};var z=a(65600),H=a(53248),W=l.createElement;const K=()=>{const e=(0,s.useDispatch)(),t=(0,s.useSelector)((e=>{var t,a,l;return(null===(t=e.relations)||void 0===t||null===(a=t.stats)||void 0===a||null===(l=a.data)||void 0===l?void 0:l.broken)||{}})),a=(0,s.useSelector)((e=>{var t,a,l;return null===(t=e.relations)||void 0===t||null===(a=t.subrequests)||void 0===a||null===(l=a.broken)||void 0===l?void 0:l.data}));return(0,l.useEffect)((()=>{e((0,T.yY)(null,!0,"broken"))}),[e]),a&&Object.keys(a).length>0?W(l.Fragment,null,W(m.c,{section:!0,hidden:!0}),W(p.c,null,W("h3",null,W(d.c,{id:"Broken relations",defaultMessage:"Broken relations"})),Object.keys(a).map((e=>W("div",{key:e},W(m.c,{section:!0,hidden:!0}),W("h4",null,W(d.c,{id:"countBrokenRelations",defaultMessage:"{countofrelation} broken {countofrelation, plural, one {relation} other {relations}} of type {typeofrelation}",values:{countofrelation:t[e],typeofrelation:e}})),W(z.c,{compact:"very"},W(z.c.Header,null,W(z.c.Row,null,W(z.c.HeaderCell,{width:6},W(d.c,{id:"Source",defaultMessage:"Source"})),W(z.c.HeaderCell,null,W(d.c,{id:"Target",defaultMessage:"Target"})))),W(z.c.Body,null,q()(a[e].items,(function(e){return e.toString()})).map(((e,t)=>W(z.c.Row,{key:t},W(z.c.Cell,null,e[0]&&W(H.c,{to:`${e[0]}/edit`,openLinkInNewTab:!0,condition:e[0].includes("http")},(0,y._c)(e[0]))),W(z.c.Cell,null,e[1]&&W(H.c,{to:`${e[1]}/edit`,openLinkInNewTab:!0,condition:e[1].includes("http")},(0,y._c)(e[1]))))))))))))):null};
1var X=a(27656),V=a.n(X),J=a(70359),Q=a.n(J),Z=a(40680),ee=a.n(Z),te=l.createElement;const ae=(0,N.compose)(P.c)((e=>{const t=(0,u.c)(),a=(0,s.useDispatch)(),{0:n,1:r}=(0,l.useState)(""),{0:i,1:c}=(0,l.useState)(""),{0:p,1:v}=(0,l.useState)(""),{0:g,1:f}=(0,l.useState)(""),{0:_,1:y}=(0,l.useState)(void 0),k=(0,s.useSelector)((e=>{var t,a;return null!==(t=null===(a=e.actions)||void 0===a?void 0:a.actions)&&void 0!==t?t:{}})),N=o()(k.user,{id:"plone_setup"}),P=(0,s.useSelector)((e=>{var t,a,l;return null===(t=e.relations)||void 0===t||null===(a=t.stats)||void 0===a||null===(l=a.data)||void 0===l?void 0:l.stats})),O=(0,s.useSelector)((e=>{var t,a,l,n,o;return null===(t=e.relations)||void 0===t||null===(a=t.stats)||void 0===a||null===(l=a.error)||void 0===l||null===(n=l.response)||void 0===n||null===(o=n.body)||void 0===o?void 0:o.error})),B=(0,s.useSelector)((e=>{var t,a,l;return null===(t=e.relations)||void 0===t||null===(a=t.stats)||void 0===a||null===(l=a.data)||void 0===l?void 0:l.broken}));let j=(0,s.useSelector)((e=>e.groups.filter_groups));j&&(j=j.map((e=>({value:e.id,label:e.title||e.id}))),j.sort((function(e,t){var a=e.label.toUpperCase(),l=t.label.toUpperCase();return a<l?-1:a>l?1:0}))),(0,l.useEffect)((()=>{a((0,T.EL)())}),[a]);const q=e=>{let t=e.target.querySelector("input");switch(t.value="",t.focus(),t.name){case"SearchY":r("");break;case"SearchX":c("");break;case"showPotentialTargets":v("/");break;case"showPotentialSources":f("/")}},$=(e,{value:t})=>{y(t)},L=e=>{f(e)},A=e=>{v(e)},G=(e=!1)=>{a(function(e=!1){const t=!0===e?{flush:1}:{};return{type:F.kf,request:{op:"post",path:"/@relations/rebuild",data:t}}}(e)).then((()=>{a((0,T.EL)()),a((0,T.yY)(null,!0,"broken"))})).then((()=>{w.toast.success(te(E.c,{success:!0,title:t.formatMessage(h.c.success),content:"Relations updated"}))})).catch((e=>{const t=JSON.parse(e.response.text);w.toast.error(te(E.c,{error:!0,title:t.error.type,content:t.error.message}))}))},z=[{menuItem:t.formatMessage(h.c.inspectRelations),pane:te(M.c.Pane,{attached:!0,key:"fix"},P?te("div",{className:"controlpanel_matrix"},te("div",{className:"controlpanel_select_relation"},te(m.c,{hidden:!0}),te(C.c,{className:"select_relation"},te(C.c.Field,null,te(R.c,{as:"h3"},te(R.c.Content,null,te(d.c,{id:"Relation name",defaultMessage:"Relation"})," ",te(D.c,{placeholder:_||t.formatMessage(h.c.selectRelation)},te(D.c.Menu,null,Object.keys(P).map((e=>te(D.c.Item,{onClick:$,value:e,className:`select-relation-${e}`,key:e},`${e} (${P[e]})`)))))))))),_?te(l.Fragment,null,te("div",{className:"controlpanel_search_wrapper"},te("div",{className:"controlpanel_search_y"},te(R.c,{as:"h4"},te(R.c.Content,null,te(d.c,{id:"Source",defaultMessage:"Source"}))),te(C.c,{className:"search_y",onSubmit:q},te(C.c.Field,null,te(x.c,{name:"SearchY",placeholder:t.formatMessage(h.c.searchRelationSource),onChange:e=>{e.target.value.length>1?r(e.target.value):r("")},id:"y-search-input"}),te(U.c.Group,null,te(U.c,{basic:!0,className:"cancel","aria-label":"cancel",onClick:e=>{e.preventDefault(),e.stopPropagation(),document.querySelector('input[name="SearchY"]').value="",r("")}},te(b.c,{name:Q(),size:"24px"}))))),te(C.c,{className:"add_potential_sources",onSubmit:q},te(C.c.Field,null,te(x.c,{name:"showPotentialSources",type:"url",value:g,placeholder:t.formatMessage(h.c.addPotentialSourcesPath),onChange:({target:e})=>L(e.value),id:"potential-sources-path-input"}),(null===g||void 0===g?void 0:g.length)>0?te(U.c.Group,null,te(U.c,{basic:!0,className:"cancel","aria-label":"clearUrlBrowser",onClick:e=>{e.preventDefault(),e.stopPropagation(),f("")}},te(b.c,{name:Q(),size:"24px"}))):te(U.c.Group,null,te(U.c,{basic:!0,icon:!0,"aria-label":"openUrlBrowser",onClick:t=>{t.preventDefault(),t.stopPropagation(),e.openObjectBrowser({mode:"link",overlay:!0,onSelectItem:e=>{L(e)}})}},te(b.c,{name:ee(),size:"24px"})))),te(d.c,{id:"Show potential sources. Not only objects that are source of some relation.",defaultMessage:"Show potential sources. Not only objects that are source of some relation."}))),te("div",{className:"controlpanel_search_x"},te(C.c,{className:"search_x",onSubmit:q},te(R.c,{as:"h4"},te(R.c.Content,null,te(d.c,{id:"Target",defaultMessage:"Target"}))),te(C.c.Field,null,te(x.c,{name:"SearchX",placeholder:t.formatMessage(h.c.searchRelationTarget),onChange:e=>{e.target.value.length>1?c(e.target.value):r("")},id:"x-search-input"}),te(U.c.Group,null,te(U.c,{basic:!0,className:"cancel","aria-label":"cancel",onClick:e=>{e.preventDefault(),e.stopPropagation(),document.querySelector('input[name="SearchX"]').value="",c("")}},te(b.c,{name:Q(),size:"24px"}))))),te(C.c,{className:"add_potential_targets",onSubmit:q},te(C.c.Field,null,te(x.c,{name:"showPotentialTargets",type:"url",value:p,placeholder:t.formatMessage(h.c.addPotentialTargetsPath),onChange:({target:e})=>A(e.value),id:"potential-targets-path-input"}),(null===p||void 0===p?void 0:p.length)>0?te(U.c.Group,null,te(U.c,{basic:!0,className:"cancel","aria-label":"clearUrlBrowser",onClick:e=>{e.preventDefault(),e.stopPropagation(),v("")}},te(b.c,{name:Q(),size:"24px"}))):te(U.c.Group,null,te(U.c,{basic:!0,icon:!0,"aria-label":"openUrlBrowser",onClick:t=>{t.preventDefault(),t.stopPropagation(),e.openObjectBrowser({mode:"link",overlay:!0,onSelectItem:e=>{A(e)}})}},te(b.c,{name:ee(),size:"24px"})))),te("div",{className:"foo"},te(d.c,{id:"Show potential targets. Not only objects that are target of some relation.",defaultMessage:"Show potential targets. Not only objects that are target of some relation."})," ",te(I.c,{trigger:te("a",{href:"https://6.docs.plone.org/volto/development/widget.html#widget-relation-field-label",target:"_blank",rel:"noopener noreferrer"},te(b.c,{name:V(),size:"16px"}))},te(I.c.Header,null,"Respect constraints"),te(I.c.Content,null,te("div",null,"See docs.plone.org on how to respect c
1onstraints."))))))),te("div",{className:"controlpanel_listing_wrapper"},te(Y,{relationtype:_,query_source:n,query_target:i,potential_targets_path:p,potential_sources_path:g}))):null):te("p",null,te("b",null,null===O||void 0===O?void 0:O.type)," ",null===O||void 0===O?void 0:O.message))},{menuItem:t.formatMessage(h.c.fixRelations),pane:te(M.c.Pane,{attached:!0,key:"rebuild"},te("div",null,!(B&&Object.keys(B).length>0)&&te("div",null,te(d.c,{id:"No broken relations found.",defaultMessage:"No broken relations found."})),N?te(l.Fragment,null,te(m.c,{hidden:!0}),te("h2",null,S()(t.formatMessage(h.c.rebuildRelations))),te(U.c.Group,null,te(U.c,{primary:!0,onClick:()=>G(!1),content:t.formatMessage(h.c.rebuildRelations),"aria-label":t.formatMessage(h.c.rebuildRelations)})),te(m.c,{hidden:!0}),te("h2",null,S()(t.formatMessage(h.c.flushAndRebuildRelations))),te("div",{dangerouslySetInnerHTML:{__html:t.formatMessage(h.c.flushAndRebuildRelationsHints)}}),te(m.c,{hidden:!0}),te(U.c.Group,null,te(U.c,{secondary:!0,color:"red",onClick:()=>G(!0),content:t.formatMessage(h.c.flushAndRebuildRelations),"aria-label":t.formatMessage(h.c.flushAndRebuildRelations)}))):null,te(K,null)))}];return te(M.c,{panes:z,renderActiveOnly:!1,menu:{secondary:!0,pointing:!0,attached:!0,tabular:!0}})}));var le=a(84720),ne=a.n(le),oe=l.createElement;const se=()=>{const e=(0,u.c)(),t=(0,i.Uz)(),a=(0,i.IT)(),n=(0,s.useDispatch)(),{0:k,1:S}=(0,l.useState)(!1);(0,l.useEffect)((()=>{S(!0)}),[]);const N=(0,s.useSelector)((e=>{var t,a,l;return null===(t=e.relations)||void 0===t||null===(a=t.stats)||void 0===a||null===(l=a.data)||void 0===l?void 0:l.broken})),w=(0,s.useSelector)((e=>{var t,a;return null===(t=e.relations)||void 0===t||null===(a=t.stats)||void 0===a?void 0:a.data})),M=(0,s.useSelector)((e=>{var t,a;return null!==(t=null===(a=e.actions)||void 0===a?void 0:a.actions)&&void 0!==t?t:{}})),C=o()(M.object,{id:"edit"});return(0,l.useEffect)((()=>{n((0,f.K)("/"))}),[n]),oe(l.Fragment,null,oe("div",{className:""},oe("div",{className:"relations-control-panel"},oe(g.c,{title:e.formatMessage(h.c.relations)}),C?oe(p.c.Group,{raised:!0},oe(p.c,{className:"primary"},N&&Object.keys(N).length>0?oe(l.Fragment,null,oe(v.c,{warning:!0},oe(d.c,{id:"Some relations are broken. Please fix.",defaultMessage:"Some relations are broken. Please fix."})),oe(m.c,{hidden:!0})):null,oe("h1",null,oe(d.c,{id:"Relations",defaultMessage:"Relations"})),null!==w&&void 0!==w&&w.error?oe(l.Fragment,null,oe(m.c,{hidden:!0}),oe(v.c,{warning:!0},oe(d.c,{id:"Please upgrade to plone.restapi >= 8.39.0.",defaultMessage:"Please upgrade to plone.restapi >= 8.39.0."}))):null),oe(p.c,null,oe(ae,null))):oe(p.c.Group,null,oe(p.c,null,oe(d.c,{id:"Relations",defaultMessage:"Relations"}),oe(m.c,{hidden:!0}),oe(d.c,{id:"You have not the required permission for this control panel.",defaultMessage:"You have not the required permission for this control panel."}))))),k&&(0,r.createPortal)(oe(_.c,{pathname:a.pathname,hideDefaultViewButtons:!0,inner:oe(c.cH,{className:"item",to:"#",onClick:()=>{t.push((0,y.yn)(a.pathname))}},oe(b.c,{name:ne(),className:"contents circled",size:"30px"}))}),document.getElementById("toolbar")))}}}]);
2//# sourceMappingURL=plone-volto-components-manage-Controlpanels-Relations-Relations.63d212e9.chunk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.