Bläddra i källkod

API get template collabora

Marino Faggiana 6 år sedan
förälder
incheckning
bf707b9b16

+ 2 - 1
iOSClient/Library/OCCommunicationLib/OCCommunication.m

@@ -2796,7 +2796,8 @@
 
 - (void)createTemplateRichdocuments:(NSString *)serverPath template:(NSString *)template onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *link, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
     
-    serverPath = [serverPath stringByAppendingString:k_url_create_link_mobile_editor];
+    serverPath = [serverPath stringByAppendingString:k_url_create_template_mobile_editor];
+    serverPath = [serverPath stringByAppendingString:template];
     serverPath = [serverPath stringByAppendingString:@"?format=json"];
     
     OCWebDAVClient *request = [[OCWebDAVClient alloc] init];

+ 1 - 1
iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m

@@ -1211,7 +1211,7 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     NSParameterAssert(success);
     
-    _requestMethod = @"POST";
+    _requestMethod = @"GET";
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
     [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];

+ 26 - 1
iOSClient/Main/CCCreateCloud.swift

@@ -98,7 +98,13 @@ class CreateMenuAdd: NSObject {
             }
             if item.value as? Int == 5 { self.appDelegate.activeMain.createFolder() }
 
-            if item.value as? Int == 6 { print("Cancel buttons has the value `true`") }
+            if item.value as? Int == 6 {
+                let form = CreateFormUploadRichdocuments.init(typeTemplate: k_richdocument_document)
+                let navigationController = UINavigationController.init(rootViewController: form)
+                navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
+                
+                self.appDelegate.window.rootViewController?.present(navigationController, animated: true, completion: nil)
+            }
             if item.value as? Int == 7 { print("Cancel buttons has the value `true`") }
             if item.value as? Int == 8 { print("Cancel buttons has the value `true`") }
 
@@ -109,6 +115,25 @@ class CreateMenuAdd: NSObject {
     }
 }
 
+
+// MARK: -
+
+class CreateFormUploadRichdocuments: XLFormViewController {
+    
+    let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    
+    @objc convenience init(typeTemplate : String) {
+        self.init()
+        
+        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: { (url) in
+            //
+        }, failure: { (message, errorCode) in
+            //
+        })
+    }
+}
 // MARK: -
 
 @objc protocol createFormUploadAssetsDelegate {