|
@@ -115,16 +115,79 @@ class CreateMenuAdd: NSObject {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
// MARK: -
|
|
// MARK: -
|
|
|
|
|
|
-class CreateFormUploadRichdocuments: XLFormViewController {
|
|
|
|
|
|
+class CreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate {
|
|
|
|
|
|
|
|
+ var typeTemplate = ""
|
|
|
|
+ var serverUrl = ""
|
|
|
|
+ var fileNameFolder = ""
|
|
|
|
+ var fileName = ""
|
|
let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
|
let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
|
|
|
|
|
@objc convenience init(typeTemplate : String) {
|
|
@objc convenience init(typeTemplate : String) {
|
|
self.init()
|
|
self.init()
|
|
|
|
|
|
|
|
+ self.typeTemplate = typeTemplate
|
|
|
|
+ serverUrl = appDelegate.activeMain.serverUrl
|
|
|
|
+
|
|
|
|
+ if serverUrl == CCUtility.getHomeServerUrlActiveUrl(appDelegate.activeUrl) {
|
|
|
|
+ fileNameFolder = "/"
|
|
|
|
+ } else {
|
|
|
|
+ fileNameFolder = (serverUrl as NSString).lastPathComponent
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ self.initializeForm()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func initializeForm() {
|
|
|
|
+
|
|
|
|
+ let form : XLFormDescriptor = XLFormDescriptor(title: NSLocalizedString("_upload_photos_videos_", comment: "")) as XLFormDescriptor
|
|
|
|
+ form.rowNavigationOptions = XLFormRowNavigationOptions.stopDisableRow
|
|
|
|
+
|
|
|
|
+ var section : XLFormSectionDescriptor
|
|
|
|
+ var row : XLFormRowDescriptor
|
|
|
|
+
|
|
|
|
+ // Section: Destination Folder
|
|
|
|
+
|
|
|
|
+ section = XLFormSectionDescriptor.formSection(withTitle: NSLocalizedString("_save_path_", comment: ""))
|
|
|
|
+ form.addFormSection(section)
|
|
|
|
+
|
|
|
|
+ row = XLFormRowDescriptor(tag: "ButtonDestinationFolder", rowType: XLFormRowDescriptorTypeButton, title: fileNameFolder)
|
|
|
|
+ row.action.formSelector = #selector(changeDestinationFolder(_:))
|
|
|
|
+
|
|
|
|
+ let imageFolder = CCGraphics.changeThemingColorImage(UIImage(named: "folder")!, multiplier:1, color: NCBrandColor.sharedInstance.brandElement) as UIImage
|
|
|
|
+ row.cellConfig["imageView.image"] = imageFolder
|
|
|
|
+
|
|
|
|
+ row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue
|
|
|
|
+ row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
|
|
|
|
+
|
|
|
|
+ section.addFormRow(row)
|
|
|
|
+
|
|
|
|
+ // Section: File Name
|
|
|
|
+
|
|
|
|
+ section = XLFormSectionDescriptor.formSection(withTitle: NSLocalizedString("_filename_", comment: ""))
|
|
|
|
+ form.addFormSection(section)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ row = XLFormRowDescriptor(tag: "fileName", rowType: XLFormRowDescriptorTypeAccount, title: NSLocalizedString("_filename_", comment: ""))
|
|
|
|
+ row.value = self.fileName
|
|
|
|
+
|
|
|
|
+ row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
|
|
|
|
+
|
|
|
|
+ row.cellConfig["textField.textAlignment"] = NSTextAlignment.right.rawValue
|
|
|
|
+ row.cellConfig["textField.font"] = UIFont.systemFont(ofSize: 15.0)
|
|
|
|
+
|
|
|
|
+ section.addFormRow(row)
|
|
|
|
+
|
|
|
|
+ self.form = form
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // MARK: - View Life Cycle
|
|
|
|
+
|
|
|
|
+ override func viewDidLoad() {
|
|
|
|
+ super.viewDidLoad()
|
|
|
|
+
|
|
let ocNetworking = OCnetworking.init(delegate: nil, metadataNet: nil, withUser: appDelegate.activeUser, withUserID: appDelegate.activeUserID, withPassword: appDelegate.activePassword, withUrl: appDelegate.activeUrl)
|
|
let ocNetworking = OCnetworking.init(delegate: nil, metadataNet: nil, withUser: appDelegate.activeUser, withUserID: appDelegate.activeUserID, withPassword: appDelegate.activePassword, withUrl: appDelegate.activeUrl)
|
|
|
|
|
|
ocNetworking?.createTemplateRichdocuments(withTemplate: typeTemplate, success: { (listOfTemplate) in
|
|
ocNetworking?.createTemplateRichdocuments(withTemplate: typeTemplate, success: { (listOfTemplate) in
|
|
@@ -132,8 +195,86 @@ class CreateFormUploadRichdocuments: XLFormViewController {
|
|
}, failure: { (message, errorCode) in
|
|
}, failure: { (message, errorCode) in
|
|
//
|
|
//
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+ let cancelButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(cancel))
|
|
|
|
+ let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
|
|
|
|
+
|
|
|
|
+ self.navigationItem.leftBarButtonItem = cancelButton
|
|
|
|
+ self.navigationItem.rightBarButtonItem = saveButton
|
|
|
|
+
|
|
|
|
+ self.navigationController?.navigationBar.isTranslucent = false
|
|
|
|
+ self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
|
|
|
|
+ self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brandText
|
|
|
|
+ self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
|
|
|
|
+
|
|
|
|
+ self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
|
|
|
|
+
|
|
|
|
+ self.reloadForm()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func reloadForm() {
|
|
|
|
+
|
|
|
|
+ self.form.delegate = nil
|
|
|
|
+
|
|
|
|
+ let buttonDestinationFolder : XLFormRowDescriptor = self.form.formRow(withTag: "ButtonDestinationFolder")!
|
|
|
|
+ buttonDestinationFolder.title = fileNameFolder
|
|
|
|
+
|
|
|
|
+ self.tableView.reloadData()
|
|
|
|
+ self.form.delegate = self
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // MARK: - Action
|
|
|
|
+
|
|
|
|
+ func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String) {
|
|
|
|
+
|
|
|
|
+ guard let serverUrl = serverUrl else {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ self.serverUrl = serverUrl
|
|
|
|
+ if serverUrl == CCUtility.getHomeServerUrlActiveUrl(appDelegate.activeUrl) {
|
|
|
|
+ fileNameFolder = "/"
|
|
|
|
+ } else {
|
|
|
|
+ fileNameFolder = (serverUrl as NSString).lastPathComponent
|
|
|
|
+ }
|
|
|
|
+ reloadForm()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @objc func changeDestinationFolder(_ sender: XLFormRowDescriptor) {
|
|
|
|
+
|
|
|
|
+ self.deselectFormRow(sender)
|
|
|
|
+
|
|
|
|
+ let storyboard = UIStoryboard(name: "NCSelect", bundle: nil)
|
|
|
|
+ let navigationController = storyboard.instantiateInitialViewController() as! UINavigationController
|
|
|
|
+ let viewController = navigationController.topViewController as! NCSelect
|
|
|
|
+
|
|
|
|
+ viewController.delegate = self
|
|
|
|
+ viewController.hideButtonCreateFolder = false
|
|
|
|
+ viewController.includeDirectoryE2EEncryption = false
|
|
|
|
+ viewController.includeImages = false
|
|
|
|
+ viewController.layoutViewSelect = k_layout_view_move
|
|
|
|
+ viewController.selectFile = false
|
|
|
|
+ viewController.titleButtonDone = NSLocalizedString("_select_", comment: "")
|
|
|
|
+ viewController.type = ""
|
|
|
|
+
|
|
|
|
+ navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
|
|
|
|
+ self.present(navigationController, animated: true, completion: nil)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @objc func save() {
|
|
|
|
+
|
|
|
|
+ self.dismiss(animated: true, completion: {
|
|
|
|
+
|
|
|
|
+ //self.appDelegate.activeMain.uploadFileAsset(self.assets, serverUrl: self.serverUrl, useSubFolder: useSubFolder, session: self.session)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @objc func cancel() {
|
|
|
|
+
|
|
|
|
+ self.dismiss(animated: true, completion: nil)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
// MARK: -
|
|
// MARK: -
|
|
|
|
|
|
@objc protocol createFormUploadAssetsDelegate {
|
|
@objc protocol createFormUploadAssetsDelegate {
|
|
@@ -141,8 +282,6 @@ class CreateFormUploadRichdocuments: XLFormViewController {
|
|
func dismissFormUploadAssets()
|
|
func dismissFormUploadAssets()
|
|
}
|
|
}
|
|
|
|
|
|
-// MARK: -
|
|
|
|
-
|
|
|
|
class CreateFormUploadAssets: XLFormViewController, CCMoveDelegate {
|
|
class CreateFormUploadAssets: XLFormViewController, CCMoveDelegate {
|
|
|
|
|
|
var serverUrl : String = ""
|
|
var serverUrl : String = ""
|
|
@@ -191,7 +330,7 @@ class CreateFormUploadAssets: XLFormViewController, CCMoveDelegate {
|
|
row = XLFormRowDescriptor(tag: "ButtonDestinationFolder", rowType: XLFormRowDescriptorTypeButton, title: self.titleServerUrl)
|
|
row = XLFormRowDescriptor(tag: "ButtonDestinationFolder", rowType: XLFormRowDescriptorTypeButton, title: self.titleServerUrl)
|
|
row.action.formSelector = #selector(changeDestinationFolder(_:))
|
|
row.action.formSelector = #selector(changeDestinationFolder(_:))
|
|
|
|
|
|
- let imageFolder = CCGraphics.changeThemingColorImage(UIImage(named: "folder")!, multiplier:2, color: NCBrandColor.sharedInstance.brandElement) as UIImage
|
|
|
|
|
|
+ let imageFolder = CCGraphics.changeThemingColorImage(UIImage(named: "folder")!, multiplier:1, color: NCBrandColor.sharedInstance.brandElement) as UIImage
|
|
row.cellConfig["imageView.image"] = imageFolder
|
|
row.cellConfig["imageView.image"] = imageFolder
|
|
|
|
|
|
row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue
|
|
row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue
|
|
@@ -533,7 +672,7 @@ class CreateFormUploadFileText: XLFormViewController, CCMoveDelegate {
|
|
row = XLFormRowDescriptor(tag: "ButtonDestinationFolder", rowType: XLFormRowDescriptorTypeButton, title: self.titleServerUrl)
|
|
row = XLFormRowDescriptor(tag: "ButtonDestinationFolder", rowType: XLFormRowDescriptorTypeButton, title: self.titleServerUrl)
|
|
row.action.formSelector = #selector(changeDestinationFolder(_:))
|
|
row.action.formSelector = #selector(changeDestinationFolder(_:))
|
|
|
|
|
|
- let imageFolder = CCGraphics.changeThemingColorImage(UIImage(named: "folder")!, multiplier:2, color: NCBrandColor.sharedInstance.brandElement) as UIImage
|
|
|
|
|
|
+ let imageFolder = CCGraphics.changeThemingColorImage(UIImage(named: "folder")!, multiplier:1, color: NCBrandColor.sharedInstance.brandElement) as UIImage
|
|
row.cellConfig["imageView.image"] = imageFolder
|
|
row.cellConfig["imageView.image"] = imageFolder
|
|
|
|
|
|
row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue
|
|
row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue
|
|
@@ -777,7 +916,7 @@ class CreateFormUploadScanDocument: XLFormViewController, CCMoveDelegate {
|
|
row = XLFormRowDescriptor(tag: "ButtonDestinationFolder", rowType: XLFormRowDescriptorTypeButton, title: self.titleServerUrl)
|
|
row = XLFormRowDescriptor(tag: "ButtonDestinationFolder", rowType: XLFormRowDescriptorTypeButton, title: self.titleServerUrl)
|
|
row.action.formSelector = #selector(changeDestinationFolder(_:))
|
|
row.action.formSelector = #selector(changeDestinationFolder(_:))
|
|
|
|
|
|
- let imageFolder = CCGraphics.changeThemingColorImage(UIImage(named: "folder")!, multiplier:2, color: NCBrandColor.sharedInstance.brandElement) as UIImage
|
|
|
|
|
|
+ let imageFolder = CCGraphics.changeThemingColorImage(UIImage(named: "folder")!, multiplier:1, color: NCBrandColor.sharedInstance.brandElement) as UIImage
|
|
row.cellConfig["imageView.image"] = imageFolder
|
|
row.cellConfig["imageView.image"] = imageFolder
|
|
|
|
|
|
row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue
|
|
row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue
|