AppMaker和Picker小部件-上传到特定文件夹 [英] AppMaker and picker widget - uploading to a specific folder

查看:106
本文介绍了AppMaker和Picker小部件-上传到特定文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试一个按钮,以允许用户将文件上传到特定的文件夹中.我尝试遵循其他建议,并将此钩子添加到

I'm trying to have a button to allow users to upload a file, into a specific folder. I tried to follow other advise, and add this hook to

onPickerInit:

onPickerInit:

var uploadView = new google.picker.DocsUploadView()
uploadView.setParent('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); // test folder

pickerBuilder.addView(uploadView);

我已经设置了MULTISELECT_ENABLED功能(如果没有设置,则不考虑目标文件夹),事实上,我现在可以上传文件所属的文件.是的!

I've set the MULTISELECT_ENABLED feature (without it, the destination folder is not respected), and I can in fact now upload the files where they belong. Yay!

但是:现在,选择器小部件具有两个上传标签.第一个选项卡将常规文件上传到驱动器主文件夹中,第二个选项卡执行正确的操作.我的猜测是,appmaker在幕后构造了第一个上传选项卡,并且没有禁用此功能的功能.

HOWEVER: The picker widget now has two upload tabs. The first one just does the regular upload into the drive main folder, the second tab does the right thing. My guess is that appmaker contstructs the first upload tab behind the curtains and there is no feature to disable this.

这显然很古怪,几乎不可用.我的问题是:

This is obviously fairly quirky and hardly usable. My questions are:

1)pickerbuilder中是否有API调用(可能未记录)以删除原始的上传视图?

1) are there (possibly undocumented) API calls in the pickerbuilder to remove the original upload view?

2)即使MULTISELECT功能关闭,也可以尊重目标文件夹吗?

2) Is it possible to respect the destination folder even is the MULTISELECT feature is off ?

在此先感谢您提供任何务实的解决方案!

Many thanks in advance for any pragmatic solutions!

推荐答案

编辑05/26/2020

云端硬盘选择器API进行了另一项更改.为了使这项工作有效,请更改您必须做的事情:

There has been another change in the Drive picker API. To make this work please change what you have to:

var folderId = "10fYS3l32R6gk79POOSS8X_Vbsz7vqzRWX"; //the desired folder id
pickerBuilder.xw.jf["0"].Ta.parent = folderId;


编辑02/17/2020

云端硬盘选择器API发生了变化.为了使这项工作有效,请更改您必须做的事情:

There has been a change in the Drive picker API. To make this work please change what you have to:

var folderId = "10fYS3l32R6gk79POOSS8X_Vbsz7vqzRWX"; //the desired folder id
pickerBuilder.mw.$e["0"].Ra.parent = folderId;


直接回答您的问题:


To answer your questions directly:

1.)是
2.)是

1.) YES
2.) YES

现在,让我们深入研究一下幕后发生的事情.你是对的:

Now, let's dig a little bit into what's happening under the hood. You are right:

我的猜测是,appmaker在幕后构造了第一个上传选项卡,并且没有禁用它的功能.

My guess is that appmaker contstructs the first upload tab behind the curtains and there is no feature to disable this.

但是,我们可以操纵对象.因此,我们无需配置新的选择器视图,而只需配置默认视图即可将文件上传到所需的文件夹.我们可以通过执行以下操作来实现:

However, we can manipulate the object. So instead of creating a new picker view, let's simply configure the default one to upload the files to the folder you want. We can achieve that by doing the following:

1.)在将驱动器选择器插入到UI中之后,请确保驱动器选择器属性都为空:

1.) After you insert a Drive Picker into your UI, make sure the Drive Picker Properties are all empty:

2.)接下来,转到事件处理程序,然后单击 onPickerInit 事件处理程序.输入以下代码:

2.) Next, go to the event handlers and click on the onPickerInit event handler. Type in this code:

var folderId = "10fYS3l32R6gk79POOSS8X_Vbsz7vqzRWX"; //the desired folder id
pickerBuilder.SW.Vq["0"].mc.parent = folderId; 

总而言之,我得出的结论是,属性 SW 包含驱动器视图数组,这些视图保存在属性 Vq 下. Vq ["0"] 是视图数组中的第一个视图,并且 mc 属性包含功能;因此 parent = folderId .

In summary, I've come to the conclusion that the property SW contains the array of drive views, which are saved under the property Vq. Vq["0"] is the first view in the array of views and the mc property contains the features; hence parent = folderId.

这篇关于AppMaker和Picker小部件-上传到特定文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆