mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
import{j as d,o as l,k as u,l as h,t as m,z as V,b as U,c as y,u as x,w as n,e as r,m as B,f as p,g,h as Z}from"./runtime-dom.esm-bundler-DSTOTAEf.chunk.mjs";import{a as w,l as k}from"./index-xFugdZPW.chunk.mjs";import{t as c}from"./translation-DoG5ZELJ-2ffMJaM4.chunk.mjs";import"./PencilOutline-BPy7Lagu.chunk.mjs";import{c as S}from"./logger-D3RVzcfQ-iUjwSNGe.chunk.mjs";import"./index-1IDLJUNm.chunk.mjs";import{g as C}from"./createElementId-DhjFt1I9-Bjk2333q.chunk.mjs";import"./NcBreadcrumbs-DYfGaSjT-kISKYtAK.chunk.mjs";import"./NcDateTime.vue_vue_type_script_setup_true_lang-BhB8yA4U-Bb9gAlar.chunk.mjs";import{N as H}from"./index-Dzo4H_NA.chunk.mjs";import"./NcAvatar-DmUGApWA-JvdYd-8p.chunk.mjs";import"./NcRichText-CBMtJzE_-DhwkZADF.chunk.mjs";import"./mdi-kAZc0JKn.chunk.mjs";import"./index-6_gsQFyp.chunk.mjs";import{N as L}from"./NcCheckboxRadioSwitch-BCSKF7Tk-BDM2s1GW.chunk.mjs";import"./NcChip-D8tGFzRl-BmzaEo05.chunk.mjs";import"./NcColorPicker-Kc0JqRtp-DZI9oazy.chunk.mjs";import{D as T,s as j}from"./TrayArrowDown-zMGl3y4Q.chunk.mjs";import"./NcSelect-Czzsi3P_-wYuKB0zM.chunk.mjs";import"./NcEmojiPicker-pM4Pg2yq-BDMmjn1X.chunk.mjs";import"./Plus-BVjFGi0H.chunk.mjs";/* empty css */import"./NcInputField-Bwsh2aHY-Bf_22pmD.chunk.mjs";import"./NcNoteCard-CVhtNL04-CdF6Qoal.chunk.mjs";import"./NcPasswordField-djttkA5Q-DvTgf1Bu.chunk.mjs";import{c as _}from"./index-D9L8KHF3.chunk.mjs";import"./TrashCanOutline-DKx7CxBb.chunk.mjs";import"./index-CqGlcBjK.chunk.mjs";import{N as q}from"./ContentCopy-caJ7vqeg.chunk.mjs";import"./NcUserBubble-DPAmU2_J-B8QraJ_f.chunk.mjs";import"./NcUserStatusIcon-CGEf7fej-CR1VhaiT.chunk.mjs";import"./colors-Go3zmZRD-Bml2X1sg.chunk.mjs";import{d as M,a as E}from"./index-JpgrUA2Z-D4yQFKNw.chunk.mjs";import{l as I}from"./logger-CKJsLJ9Y.chunk.mjs";import"./string_decoder-BO00msnV.chunk.mjs";const G='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-cancel" viewBox="0 0 24 24"><path d="M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22 2 17.5 2 12 6.5 2 12 2M12 4C10.1 4 8.4 4.6 7.1 5.7L18.3 16.9C19.3 15.5 20 13.8 20 12C20 7.6 16.4 4 12 4M16.9 18.3L5.7 7.1C4.6 8.4 4 10.1 4 12C4 16.4 7.6 20 12 20C13.9 20 15.6 19.4 16.9 18.3Z" /></svg>',J={name:"AccountIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},K=["aria-hidden","aria-label"],P=["fill","width","height"],Q={d:"M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z"},W={key:0};function X(a,e,t,i,o,s){return l(),d("span",V(a.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon account-icon",role:"img",onClick:e[0]||(e[0]=v=>a.$emit("click",v))}),[(l(),d("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[u("path",Q,[t.title?(l(),d("title",W,m(t.title),1)):h("",!0)])],8,P))],16,K)}const Y=w(J,[["render",X]]),ee={name:"RestoreIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},te=["aria-hidden","aria-label"],ae=["fill","width","height"],oe={d:"M13,3A9,9 0 0,0 4,12H1L4.89,15.89L4.96,16.03L9,12H6A7,7 0 0,1 13,5A7,7 0 0,1 20,12A7,7 0 0,1 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0 0,0 22,12A9,9 0 0,0 13,3Z"},le={key:0};function ne(a,e,t,i,o,s){return l(),d("span",V(a.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon restore-icon",role:"img",onClick:e[0]||(e[0]=v=>a.$emit("click",v))}),[(l(),d("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[u("path",oe,[t.title?(l(),d("title",le,m(t.title),1)):h("",!0)])],8,ae))],16,te)}const R=w(ee,[["render",ne]]),ie={name:"TrayArrowUpIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},se=["aria-hidden","aria-label"],re=["fill","width","height"],ce={d:"M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 2L6.46 7.46L7.88 8.88L11 5.75V15H13V5.75L16.13 8.88L17.55 7.45L12 2Z"},de={key:0};function pe(a,e,t,i,o,s){return l(),d("span",V(a.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon tray-arrow-up-icon",role:"img",onClick:e[0]||(e[0]=v=>a.$emit("click",v))}),[(l(),d("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[u("path",ce,[t.title?(l(),d("title",de,m(t.title),1)):h("",!0)])],8,re))],16,se)}const $=w(ie,[["render",pe]]),me={class:"download-button"},ue={class:"download-button__label"},ve=U({__name:"ExampleContentDownloadButton",props:{href:{}},setup(a){return(e,t)=>(l(),y(x(S),{variant:"tertiary",href:a.href},{icon:n(()=>[B(e.$slots,"icon",{},void 0,!0)]),default:n(()=>[u("div",me,[u("span",ue,[B(e.$slots,"default",{},void 0,!0)]),r(T,{class:"download-button__icon",size:20})])]),_:3},8,["href"]))}}),O=w(ve,[["__scopeId","data-v-be40807a"]]),he=k("dav","enableDefaultContact",!1),fe=k("dav","hasCustomDefaultContact",!1),ge={name:"ExampleContactSettings",components:{NcDialog:H,NcButton:S,NcCheckboxRadioSwitch:L,IconUpload:$,IconRestore:R,IconAccount:Y,ExampleContentDownloadButton:O},setup(){return{t:c}},data(){return{enableDefaultContact:he,hasCustomDefaultContact:fe,isModalOpen:!1,loading:!1,buttons:[{label:c("dav","Cancel"),icon:G,callback:()=>{this.isModalOpen=!1}},{label:c("dav","Import"),icon:j,variant:"primary",callback:()=>{this.clickImportInput()}}]}},computed:{downloadUrl(){return C("/apps/dav/api/defaultcontact/contact")}},methods:{updateEnableDefaultContact(){_.put(C("apps/dav/api/defaultcontact/config"),{allow:!this.enableDefaultContact}).then(()=>{this.enableDefaultContact=!this.enableDefaultContact}).catch(()=>{E(c("dav","Error while saving settings"))})},toggleModal(){this.isModalOpen=!this.isModalOpen},clickImportInput(){this.$refs.exampleContactImportInput.click()},resetContact(){this.loading=!0,_.put(C("/apps/dav/api/defaultcontact/contact")).then(()=>{this.hasCustomDefaultContact=!1,M(c("dav","Contact reset successfully"))}).catch(a=>{I.error("Error importing contact:",{error:a}),E(c("dav","Error while resetting contact"))}).finally(()=>{this.loading=!1})},processFile(a){this.loading=!0;const e=a.target.files[0],t=new FileReader;t.onload=async()=>{this.isModalOpen=!1;try{await _.put(C("/apps/dav/api/defaultcontact/contact"),{contactData:t.result}),this.hasCustomDefaultContact=!0,M(c("dav","Contact imported successfully"))}catch(i){I.error("Error importing contact:",{error:i}),E(c("dav","Error while importing contact"))}finally{this.loading=!1,a.target.value=""}},t.readAsText(e)}}},Ce={class:"example-contact-settings"},we={key:0,class:"example-contact-settings__buttons"},be=["disabled"];function xe(a,e,t,i,o,s){const v=p("NcCheckboxRadioSwitch"),z=p("IconAccount"),A=p("ExampleContentDownloadButton"),D=p("IconUpload"),b=p("NcButton"),N=p("IconRestore"),F=p("NcDialog");return l(),d("div",Ce,[r(v,{modelValue:o.enableDefaultContact,type:"switch","onUpdate:modelValue":s.updateEnableDefaultContact},{default:n(()=>[g(m(i.t("dav","Add example contact to user's address book when they first log in")),1)]),_:1},8,["modelValue","onUpdate:modelValue"]),o.enableDefaultContact?(l(),d("div",we,[r(A,{href:s.downloadUrl},{icon:n(()=>[r(z,{size:20})]),default:n(()=>[e[2]||(e[2]=g(" example_contact.vcf ",-1))]),_:1},8,["href"]),r(b,{variant:"secondary",onClick:s.toggleModal},{icon:n(()=>[r(D,{size:20})]),default:n(()=>[g(" "+m(i.t("dav","Import contact")),1)]),_:1},8,["onClick"]),o.hasCustomDefaultContact?(l(),y(b,{key:0,variant:"tertiary",onClick:s.resetContact},{icon:n(()=>[r(N,{size:20})]),default:n(()=>[g(" "+m(i.t("dav","Reset to default")),1)]),_:1},8,["onClick"])):h("",!0)])):h("",!0),r(F,{open:o.isModalOpen,"onUpdate:open":e[0]||(e[0]=f=>o.isModalOpen=f),name:i.t("dav","Import contacts"),buttons:o.buttons},{default:n(()=>[u("div",null,[u("p",null,m(i.t("dav","Importing a new .vcf file will delete the existing default contact and replace it with the new one. Do you want to continue?")),1)])]),_:1},8,["open","name","buttons"]),u("input",{id:"example-contact-import",ref:"exampleContactImportInput",disabled:o.loading,type:"file",accept:".vcf",class:"hidden-visually",onChange:e[1]||(e[1]=(...f)=>s.processFile&&s.processFile(...f))},null,40,be)])}const ye=w(ge,[["render",xe],["__scopeId","data-v-db8b0002"]]),_e={name:"CalendarBlankIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Ee=["aria-hidden","aria-label"],ke=["fill","width","height"],Ie={d:"M19,19H5V8H19M16,1V3H8V1H6V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H18V1"},De={key:0};function Me(a,e,t,i,o,s){return l(),d("span",V(a.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon calendar-blank-icon",role:"img",onClick:e[0]||(e[0]=v=>a.$emit("click",v))}),[(l(),d("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[u("path",Ie,[t.title?(l(),d("title",De,m(t.title),1)):h("",!0)])],8,ke))],16,Ee)}const Ve=w(_e,[["render",Me]]);async function ze(a){const e=C("/apps/dav/api/exampleEvent/enable");await _.post(e,{enable:a})}async function Ae(a){const e=C("/apps/dav/api/exampleEvent/event");await _.post(e,{ics:a})}async function Ne(){const a=C("/apps/dav/api/exampleEvent/event");await _.delete(a)}const Fe={name:"ExampleEventSettings",components:{NcButton:S,NcCheckboxRadioSwitch:L,NcDialog:H,IconCalendarBlank:Ve,IconUpload:$,IconRestore:R,ExampleContentDownloadButton:O},setup(){return{t:c}},data(){return{createExampleEvent:k("dav","create_example_event",!1),hasCustomEvent:k("dav","has_custom_example_event",!1),showImportModal:!1,uploading:!1,deleting:!1,savingConfig:!1,selectedFile:void 0}},computed:{downloadUrl(){return C("/apps/dav/api/exampleEvent/event")}},methods:{selectFile(){this.selectedFile=this.$refs["event-file"]?.files[0]},async updateCreateExampleEvent(){this.savingConfig=!0;const a=!this.createExampleEvent;try{await ze(a)}catch(e){E(c("dav","Failed to save example event creation setting")),I.error("Failed to save example event creation setting",{error:e,enable:a})}finally{this.savingConfig=!1}this.createExampleEvent=a},uploadCustomEvent(){if(!this.selectedFile)return;this.uploading=!0;const a=new FileReader;a.addEventListener("load",async()=>{const e=a.result;try{await Ae(e)}catch(t){E(c("dav","Failed to upload the example event")),I.error("Failed to upload example ICS",{error:t,ics:e});return}finally{this.uploading=!1}M(c("dav","Custom example event was saved successfully")),this.showImportModal=!1,this.hasCustomEvent=!0}),a.readAsText(this.selectedFile)},async deleteCustomEvent(){this.deleting=!0;try{await Ne()}catch(a){E(c("dav","Failed to delete the custom example event")),I.error("Failed to delete the custom example event",{error:a});return}finally{this.deleting=!1}M(c("dav","Custom example event was deleted successfully")),this.hasCustomEvent=!1}}},Se={class:"example-event-settings"},Be={key:0,class:"example-event-settings__buttons"},Ue={class:"import-event-modal"},He=["disabled"],Le={class:"import-event-modal__buttons"};function Re(a,e,t,i,o,s){const v=p("NcCheckboxRadioSwitch"),z=p("IconCalendarBlank"),A=p("ExampleContentDownloadButton"),D=p("IconUpload"),b=p("NcButton"),N=p("IconRestore"),F=p("NcDialog");return l(),d("div",Se,[r(v,{modelValue:o.createExampleEvent,disabled:o.savingConfig,type:"switch","onUpdate:modelValue":s.updateCreateExampleEvent},{default:n(()=>[g(m(i.t("dav","Add example event to user's calendar when they first log in")),1)]),_:1},8,["modelValue","disabled","onUpdate:modelValue"]),o.createExampleEvent?(l(),d("div",Be,[r(A,{href:s.downloadUrl},{icon:n(()=>[r(z,{size:20})]),default:n(()=>[e[4]||(e[4]=g(" example_event.ics ",-1))]),_:1},8,["href"]),r(b,{variant:"secondary",onClick:e[0]||(e[0]=f=>o.showImportModal=!0)},{icon:n(()=>[r(D,{size:20})]),default:n(()=>[g(" "+m(i.t("dav","Import calendar event")),1)]),_:1}),o.hasCustomEvent?(l(),y(b,{key:0,variant:"tertiary",disabled:o.deleting,onClick:s.deleteCustomEvent},{icon:n(()=>[r(N,{size:20})]),default:n(()=>[g(" "+m(i.t("dav","Reset to default")),1)]),_:1},8,["disabled","onClick"])):h("",!0)])):h("",!0),r(F,{open:o.showImportModal,"onUpdate:open":e[3]||(e[3]=f=>o.showImportModal=f),name:i.t("dav","Import calendar event")},{default:n(()=>[u("div",Ue,[u("p",null,m(i.t("dav","Uploading a new event will overwrite the existing one.")),1),u("input",{ref:"event-file",disabled:o.uploading,type:"file",accept:".ics,text/calendar",class:"import-event-modal__file-picker",onChange:e[1]||(e[1]=(...f)=>s.selectFile&&s.selectFile(...f))},null,40,He),u("div",Le,[r(b,{disabled:o.uploading||!o.selectedFile,variant:"primary",onClick:e[2]||(e[2]=f=>s.uploadCustomEvent())},{icon:n(()=>[r(D,{size:20})]),default:n(()=>[g(" "+m(i.t("dav","Upload event")),1)]),_:1},8,["disabled"])])])]),_:1},8,["open","name"])])}const $e=w(Fe,[["render",Re],["__scopeId","data-v-88fee128"]]),Oe=U({__name:"ExampleContentSettingsSection",setup(a){const e=k("dav","contactsEnabled"),t=k("dav","calendarEnabled");return(i,o)=>(l(),y(x(q),{id:"example-content",name:x(c)("dav","Example content"),description:x(c)("dav","Example content serves to showcase the features of Nextcloud. Default content is shipped with Nextcloud, and can be replaced by custom content.")},{default:n(()=>[x(e)?(l(),y(ye,{key:0})):h("",!0),x(t)?(l(),y($e,{key:1})):h("",!0)]),_:1},8,["name","description"]))}}),Ze=Z(Oe);Ze.mount("#settings-example-content");
|
|
//# sourceMappingURL=dav-settings-admin-example-content.mjs.map
|