How to use UpdateFolder method in redwood

Best JavaScript code snippet using redwood

folderInfo.js

Source:folderInfo.js Github

copy

Full Screen

1/**2 * 文件夹详情3 */4angular.module('app')5.controller('folderInfo',function($scope,$rootScope,$stateParams,$injector,$RESOURCE){6 /** $stateParams7 * id 文件夹id(查询文件夹详情)8 * rootid 文件夹(匹配权限)9 */10 var service = $injector.get('service');11 var $ionicHistory = $injector.get('$ionicHistory');12 var $$widget = $injector.get('$$widget');13 /**14 * 文件夹-重命名15 */16 $scope.renameFolder = function(folder){17 var options = {18 title: "重命名",19 defaultText: folder.name20 };21 $$widget.POPUP.prompt(options)22 .then(function(result){23 if(result && result != folder.name){24 var updateFolder = {25 id: folder.id,26 name: result27 };28 $scope.FOLDER.updateFolder(updateFolder);29 }30 });31 };32 /**33 * 文件夹-移动34 */35 $scope.moveFolder = function(folder){36 //数据包37 var dataPackage = {38 title: "移动文件夹",39 rootid: folder.rootid,40 excludes: [folder.id],41 hideResource: true,42 disableButton: [folder.parentid],43 callback: function(data){44 var successCallback = function(){45 var newFolder = {46 id: folder.id,47 folderid: folder.parentid,48 parentid: data.newFolderId49 };50 //执行修改51 $scope.FOLDER.updateFolder(newFolder);52 };53 //判断是否提醒审核以及后续操作54 var params = {55 folderid: data.newFolderId56 };57 $injector.get('service').checkFolderAudit(params,successCallback);58 }59 };60 //打开modal61 $injector.get('$$widget').MODAL.fileSelect($scope,dataPackage);62 };63 /**64 * 文件夹-删除65 */66 $scope.deleteFolder = function(folder){67 var options = {68 title: "提醒",69 template: "<p style='text-align:center;'>确定删除该文件夹?</p>"70 };71 $$widget.POPUP.confirm(options)72 .then(function(result){73 if(result){74 $scope.FOLDER.deleteFolder(folder);75 }76 });77 };78 /**79 * 修改公开80 */81 $scope.setPublic = function(folder){82 var updateFolder = {83 id: folder.id,84 public: folder.public85 };86 $scope.FOLDER.updateFolder(updateFolder);87 };88 /**89 * 修改审批90 */91 $scope.setAudit = function(folder){92 var updateFolder = {93 id: folder.id,94 audit: folder.audit95 };96 $scope.FOLDER.updateFolder(updateFolder);97 };98 /**99 * 审核文件夹100 * @param type 'pass/refuse'101 */102 $scope.auditFolder = function(type){103 var folder = $scope.folder;104 var updateFolder = {105 id: folder.id106 };107 if(type == 'pass'){108 updateFolder.isaudit = 0;109 }else if(type == 'refuse'){110 updateFolder.isaudit = -1;111 }112 //修改成功回调113 var successCallback = function(){114 //发送消息115 var inParams = {116 to: folder.createuserid,117 from: $rootScope.USER.id,118 type: 'folder',119 id: folder.id,120 rootid: folder.rootid,121 filename: folder.name,122 icon: folder.src,123 isaudit: updateFolder.isaudit124 };125 if(updateFolder.isaudit == 0){126 inParams.title = '[审核通过] ' + folder.name;127 }else if(updateFolder.isaudit == -1){128 inParams.title = '[审核失败] ' + folder.name;129 }130 sendMessage(inParams);131 $injector.get('$ionicHistory').goBack();132 };133 //执行修改134 $scope.FOLDER.updateFolder(updateFolder,successCallback);135 };136 /**137 * 发送通知138 * @param params{userid,id,folderid,isaudit,filename,src,title}139 */140 var sendMessage = function(params){141 var $$chat = $injector.get('$$chat');142 var message = {143 to: params.to,144 from: params.from,145 msg: "[auditfile]",146 type: 'chat',147 msgType: 'auditfile',148 ext: {149 ext: params150 }151 };152 //发送消息153 $$chat.sendMsg(message);154 //本地保存155 $$chat.addMsg(message);156 };157 /**158 * 是否显示权限功能159 */160 $scope.showCompetence = function(){161 if($stateParams.rootid && $rootScope.USER.folderid != $stateParams.rootid){ //自己的文件夹不显示162 return true;163 }else{164 return false;165 }166 };167 /**168 * 进入文件库169 */170 $scope.enterShowPan = function(folder){171 var inParams = {172 domain: $scope.getDomain(),173 id: folder.id,174 title: folder.name,175 rootid: folder.rootid176 };177 $injector.get('$state').go('showPan',inParams);178 };179 /** 文件夹*/180 $scope.FOLDER = {181 /**182 * 获取文件夹详情183 */184 getFolderInfo: function(folderid){185 var inParams = {186 folderid: folderid? folderid : $stateParams.id187 };188 $RESOURCE.FOLDER.getFolderInfo(inParams,function(result){189 if(result.result == 1){190 var folder = result.data;191 //处理图标192 if(folder.foldertype == 'chat'){193 folder.src = 'img/filetype/folder-org.png';194 }else if(folder.foldertype == 'group'){195 folder.src = 'img/filetype/folder-user.png';196 }else{197 if($rootScope.USER.folderid == folder.rootid){198 folder.src = 'img/filetype/folder-user.png';199 }else{200 folder.src = 'img/filetype/folder-org.png';201 }202 }203 //处理日期204 var createtime = $injector.get('$$data').DATE.format(new Date(parseInt(folder.createtime)),'yyyy-MM-dd hh:mm');205 folder.createtime = createtime;206 //文件位置207 if(folder.path){208 var path = JSON.parse(folder.path);209 folder.pathList = path;210 }211 //装载数据212 $scope.folder = folder;213 }else if(result.result == 2){214 $injector.get('service').activeSessionProxy(function(){215 $scope.FOLDER.getFolderInfo(folderid);216 });217 }else{218 $injector.get('toastr').error(result.description);219 }220 });221 },222 /** 修改文件夹223 * updateFile{id,name,parentid}224 */225 updateFolder: function(updateFolder,successCallback){226 var inParams = {};227 var folder = [{228 id: updateFolder.id229 }];230 if(updateFolder.name){ //重命名231 folder[0].name = updateFolder.name;232 }233 if(updateFolder.parentid){ //移动234 folder[0].parentid = updateFolder.parentid;235 }236 if(updateFolder.public == 0 || updateFolder.public){ //公开237 folder[0].public = updateFolder.public;238 }239 if(updateFolder.audit == 0 ||updateFolder.audit){ //审批240 folder[0].audit = updateFolder.audit;241 }242 if(updateFolder.isaudit == 0 || updateFolder.isaudit){ //通过/决绝审批243 folder[0].isaudit = updateFolder.isaudit;244 }245 inParams.updateString = JSON.stringify(folder);246 //执行修改247 $RESOURCE.FOLDER.updateFolder(inParams,function(result){248 if(result.result == 1){249 if(successCallback){250 successCallback();251 }else{252 //刷新253 $scope.FOLDER.getFolderInfo(updateFolder.id);254 }255 }else if(result.result == 2){256 service.activeSessionProxy(function(){257 $scope.FOLDER.updateFolder(updateFolder);258 });259 }else{260 //设置权限toggle出错,复位261 $scope.FOLDER.getFolderInfo(updateFolder.id);262 service.showMsg("error",result.description);263 }264 });265 },266 /** 删除文件夹267 * folder268 */269 deleteFolder: function(folder){270 //封装参数271 var params = {272 deleteString: JSON.stringify([{id: folder.id}])273 };274 //执行删除275 $RESOURCE.FOLDER.deleteFolder(params,function(result){276 if(result.result == 1){//删除成功277 $ionicHistory.goBack();278 }else if(result.result == 2){ //session过期279 service.activeSessionProxy(function(){280 $scope.FOLDER.deleteFolder(folder);281 });282 283 }else{284 service.showMsg("error",result.description);285 }286 });287 } 288 };289 /** 视图进入*/290 $scope.$on('$ionicView.enter',function(){291 $scope.FOLDER.getFolderInfo();292 });...

Full Screen

Full Screen

UpdateGPOitemProtected.js

Source:UpdateGPOitemProtected.js Github

copy

Full Screen

1var appRoot = appRoot = require('app-root-path');2var utilities = require(appRoot + '/shared/utilities');3//Have to pass the name of this new class as string if inheriting parent4//constructor5//var UpdateGPOitem = utilities.inheritClass(UpdateGPOgenericClass,"UpdateGPOitem");6var UpdateGPOgenericClass = require(appRoot + '/shared/UpdateGPOgeneric');7//Call parent constructor and then use child constructor stuff too8utilities.inheritClass(UpdateGPOgenericClass,UpdateGPOitemProtected);9//Name this function so that class name will come up in debugger, etc.10function UpdateGPOitemProtected(collections,session,config) {11 //Run the parent constructor first12 //"id" is the updateKey used for updating and "item" is just updateName which13 //is text used on errors, logging, etc14 this.__parent__.constructor15 .call(this,'id','item protected',collections.items,null,session,config);16 //New stuff now17 this.collections = collections;18 //The update fields here is only protect. Override what parent created19 this.updateFields = ['protected'];20 //Current Owner of item that will be updated21 this.updateOwner = null;22 //Update Folder for item needed23 this.updateFolder = null;24}25UpdateGPOitemProtected.prototype.checkPermission = function() {26 //Check if logged in user can update this item27 var self = this;28 var Q = require('q');29 var GPOid = self.updateDoc.id;30 var hasPermission = false;31 return Q(self.collection.findOne({id: GPOid},{fields: {owner: 1}}))32 .then(function(doc) {33 //If owner ID of this object is accessible by user then update otherwise34 //if (doc && self.session.user.ownerIDs.indexOf(doc.owner) >= 0) {35//Now only have to be admin to change protection level on any item if we can find the doc36 if (doc && self.user.isAdmin) {37 self.updateOwner = doc.owner;38 hasPermission = true;39 }else {40 hasPermission = false;41 }42 })43 //Have to get owner Folder to call protect endpoint on ESRI. Goofy that item can't be updated by id alone...44 .then(function() {45 //Don't even get the folder if user doesn't have permission46 if (hasPermission) {47 return self.getOwnerFolder(GPOid);48 }else {49 return false;50 }51 })52 .then(function() {53 return hasPermission;54 });55};56UpdateGPOitemProtected.prototype.getOwnerFolder = function(id) {57 var self = this;58 var itemURL = this.config.portal + '/sharing/rest/content/items/' + id ;59 var qs = {token: self.session.token,f: 'json'};60 //Pass parameters via form attribute61 var requestPars = {method: 'get', url: itemURL, qs: qs };62 return this.hr.callAGOL(requestPars)63 .then(function(body) {64 // Var body = JSON.parse(bodyJSON);65 if (body.error) {66 console.error(body.error);67 throw(new Error('Error getting owner Folder : ' +68 JSON.stringify(body.error)));69 }70 self.updateFolder = body.ownerFolder;71 console.log(self.updateFolder);72 return self.updateFolder;73 });74};75UpdateGPOitemProtected.prototype.getRemoteUpdateRequest = function(formData) {76 var fs = require('fs');77 var self = this;78 //Overwrite the form data that was passed in because we have custom fields that are different than local79 //For protect/unprotect don't need to pass anything so just make this empty80 formData = self.parseFormData({},[]);81 var updateFolder = self.updateFolder || '';82 if (updateFolder) {83 updateFolder = '/' + updateFolder;84 }85 //Have to get the protect or unprotect endpoint86 var endpoint = self.updateDoc.protected ? 'protect' : 'unprotect';87 var url = self.config.portal + '/sharing/rest/content/users/' +88 self.updateOwner + updateFolder + '/items/' + self.updateDoc.id + '/' + endpoint;89 var qs = {token: self.session.token,f: 'json'};90 // Console.log(req.session.token);91 //Pass parameters via form attribute92 var requestPars = {method: 'post', url: url, formData: formData, qs: qs };93 return requestPars;94};95//Creating child version of this to take care of Audit and thumbnail stuff96UpdateGPOitemProtected.prototype.updateLocal = function() {97 //Don't do anything locally for protect yet98 return false;99};...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1import React from 'react';2import {connect} from "react-redux";3import { hide } from "./logic/modalActions";4import { update } from "../logic/folderActions";5import PropTypes from "prop-types";6import {bindActionCreators} from "redux";7import {Modal, Button, Form} from 'react-bootstrap';8import NameField from '../Form/NameField';9import FolderSchema from "../FolderSchema";10import {Formik} from "formik";11class UpdateFolder extends React.Component {12 handleCancel = () => {13 this.props.hide();14 };15 render() {16 return (17 <Modal className="sho-modal" show={this.props.updateFolderModal.show} onHide={this.handleCancel}>18 {19 this.props.updateFolderModal.folder &&20 <Formik21 initialValues={{22 id: this.props.updateFolderModal.folder.id,23 name: this.props.updateFolderModal.folder.name24 }}25 validationSchema={FolderSchema}26 onSubmit={(values, {setSubmitting}) => {27 this.props.updateFolder(values);28 setSubmitting(false);29 this.props.hide();30 }}31 >32 {({33 values,34 errors,35 touched,36 handleChange,37 handleBlur,38 handleSubmit,39 isSubmitting40 }) => (41 <Form42 noValidate43 onSubmit={handleSubmit}44 >45 <Modal.Header>46 <Modal.Title>Edit Folder</Modal.Title>47 </Modal.Header>48 <Modal.Body>49 <NameField50 value={values.name}51 onChange={handleChange}52 onBlur={handleBlur}53 isInvalid={errors.name && touched.name}54 errors={errors.name}55 />56 </Modal.Body>57 <Modal.Footer>58 <Button variant="outline-secondary" onClick={this.handleCancel}>59 Cancel60 </Button>61 <Button variant="success" type="submit" disabled={isSubmitting}>62 Update63 </Button>64 </Modal.Footer>65 </Form>66 )}67 </Formik>68 }69 </Modal>70 );71 }72}73UpdateFolder.propTypes = {74 hide: PropTypes.func,75 updateFolder: PropTypes.func,76 updateFolderModal: PropTypes.shape({77 show: PropTypes.bool78 })79};80UpdateFolder.defaultProps = {81 updateFolderModal: {82 show: false83 }84};85const mapStateToProps = state => ({86 updateFolderModal: state.updateFolderModal87});88const mapDispatchToProps = dispatch => ({89 hide: bindActionCreators(hide, dispatch),90 updateFolder: bindActionCreators(update, dispatch),91});...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('redwood');2redwood.updateFolder('folderPath', 'folderName', 'newFolderPath', 'newFolderName', function(err, data) {3 if(err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var redwood = require('redwood');10redwood.deleteFolder('folderPath', 'folderName', function(err, data) {11 if(err) {12 console.log(err);13 } else {14 console.log(data);15 }16});17var redwood = require('redwood');18redwood.getFile('filePath', 'fileName', function(err, data) {19 if(err) {20 console.log(err);21 } else {22 console.log(data);23 }24});25var redwood = require('redwood');26redwood.getFile('filePath', 'fileName', function(err, data) {27 if(err) {28 console.log(err);29 } else {30 console.log(data);31 }32});33var redwood = require('redwood');34redwood.getFile('filePath', 'fileName', function(err, data) {35 if(err) {36 console.log(err);37 } else {38 console.log(data);39 }40});41var redwood = require('redwood');42redwood.getFile('filePath', 'fileName', function(err, data) {43 if(err) {44 console.log(err);45 } else {46 console.log(data);47 }48});49var redwood = require('redwood');50redwood.getFile('filePath', 'fileName', function(err, data) {51 if(err) {52 console.log(err);53 } else {54 console.log(data);55 }56});57var redwood = require('redwood');58redwood.getFile('filePath', 'fileName', function(err, data) {59 if(err) {60 console.log(err);

Full Screen

Using AI Code Generation

copy

Full Screen

1var folder = new Folder();2folder.Name = "MyFolder";3folder.Description = "MyFolder Description";4folder.Id = 1;5client.UpdateFolder(folder, function (data) {6 alert(data);7});8client.DeleteFolder(1, function (data) {9 alert(data);10});11client.GetFolder(1, function (data) {12 alert(data);13});14client.GetFolders(function (data) {15 alert(data);16});17var folder = new Folder();18folder.Name = "MyFolder";19folder.Description = "MyFolder Description";20client.CreateFolder(folder, function (data) {21 alert(data);22});23RedwoodClient(string url)24CreateFolder(Folder folder, Action<string> success, Action<string> error)25UpdateFolder(Folder folder, Action<string> success, Action<string> error)26DeleteFolder(int id, Action<string> success, Action<string> error)27GetFolder(int id, Action<string> success, Action<string> error)28GetFolders(Action<string> success, Action<string> error)

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('redwood');2var fs = require('fs');3var folder = fs.readFileSync('folder.json');4var id = 1;5redwood.updateFolder(id, folder, function(err, updatedFolder) {6 if (err) {7 console.error(err);8 } else {9 console.log(updatedFolder);10 }11});

Full Screen

Using AI Code Generation

copy

Full Screen

1var folderService = require('redwood-folder-service');2var folderService = new folderService();3var folderId = 10000000;4var folderName = 'test';5var folderDescription = 'test';6folderService.UpdateFolder(folderId, folderName, folderDescription, function (err, result) {7 if (err) {8 console.log(err);9 }10 else {11 console.log(result);12 }13});14### DeleteFolder(folderId, callback)15var folderService = require('redwood-folder-service');16var folderService = new folderService();17var folderId = 10000000;18folderService.DeleteFolder(folderId, function (err, result) {19 if (err) {20 console.log(err);21 }22 else {23 console.log(result);24 }25});26### GetFolder(folderId, callback)27var folderService = require('redwood-folder-service');28var folderService = new folderService();29var folderId = 10000000;30folderService.GetFolder(folderId, function (err, result) {31 if (err) {32 console.log(err);33 }34 else {35 console.log(result);36 }37});38### GetFolderByName(folderName, callback)

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('redwood');2client.updateFolder("folderid", "name", "description", function(err, res){3 if(err){4 console.log(err);5 }6 else{7 console.log(res);8 }9});10var redwood = require('redwood');11client.deleteFolder("folderid", function(err, res){12 if(err){13 console.log(err);14 }15 else{16 console.log(res);17 }18});19var redwood = require('redwood');20client.renameFolder("folderid", "newname", function(err, res){21 if(err){22 console.log(err);23 }24 else{25 console.log(res);26 }27});28var redwood = require('redwood');29client.getFolderContents("folderid", function(err, res){30 if(err){31 console.log(err);32 }33 else{34 console.log(res);35 }36});37var redwood = require('redwood');38client.getFolder("folderid", function(err, res){39 if(err){40 console.log(err);41 }42 else{43 console.log(res);44 }45});46var redwood = require('redwood');47client.getFolderContentsByType("folderid", "type", function(err, res){48 if(err){49 console.log(err);50 }51 else{52 console.log(res);53 }54});

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('redwood');2var updateFolder = redwood.updateFolder;3var folderId = '8a2d9b9f-1a0e-4a6a-bf6f-70d3c3d3f3b3';4var folderName = 'updated folder name';5updateFolder(folderId, folderName, function(err, data) {6 if (err) {7 console.log(err);8 } else {9 console.log(data);10 }11});12var redwood = require('redwood');13var getFolder = redwood.getFolder;14var folderId = '8a2d9b9f-1a0e-4a6a-bf6f-70d3c3d3f3b3';15getFolder(folderId, function(err, data) {16 if (err) {17 console.log(err);18 } else {19 console.log(data);20 }21});22var redwood = require('redwood');23var deleteFolder = redwood.deleteFolder;24var folderId = '8a2d9b9f-1a0e-4a6a-bf6f-70d3c3d3f3b3';25deleteFolder(folderId, function(err, data) {26 if (err) {27 console.log(err);28 } else {29 console.log(data);30 }31});32var redwood = require('redwood');33var getFolderList = redwood.getFolderList;34getFolderList(function(err, data) {35 if (err) {36 console.log(err);37 } else {38 console.log(data);39 }40});41var redwood = require('redwood');42var createDocument = redwood.createDocument;

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run redwood automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful