Browse code

added CHANGELOG.txt Contributors.txt appinfo/info.xml appinfo/signature.json js/sendfax.js templates/settings.php

DoubleBastionAdmin authored on 28/04/2022 22:58:31
Showing 6 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,21 @@
1
+======= CHANGELOG =======
2
+
3
+Versions:
4
+
5
+== 1.0.0 - 2022-1-27 ==
6
+* Initial release.
7
+
8
+== 1.0.1 - 2022-3-31 ==
9
+* Changed presentation text.
10
+
11
+== 1.0.2 - 2022-4-11 ==
12
+* Respect custom 'datadirectory'.
13
+* Fixed received/sent faxes list not shown in the right hand pane when clicking the 'Received Faxes/Sent Faxes' button, while using Apache as a web server.
14
+* Fixed error when uploading pdf files, while using Apache as a web server.
15
+
16
+== 1.0.3 - 2022-4-14 ==
17
+* Changed the way the app gets the timezone.
18
+
19
+== 1.0.4 - 2022-4-29 ==
20
+* Specified how usernames containing an @ can be included in the callback URL, on the Settings page.
21
+* Adjusted pdf files paths, so that uploaded pdf files can be previewed when Nextcloud is served on a subdomain or on a subdirectory, by Nginx or by Apache. 
0 22
new file mode 100644
... ...
@@ -0,0 +1,4 @@
1
+========================== CONTRIBUTORS ==========================
2
+
3
+1. Double Bastion LLC  <www.doublebastion.com>
4
+2. Damon Hart          <damon.hart [at] dlhtechserv.com>
0 5
new file mode 100644
... ...
@@ -0,0 +1,72 @@
1
+<?xml version="1.0"?>
2
+<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
3
+      xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
4
+    <id>pax_fax</id>
5
+    <name>Pax Fax</name>
6
+    <summary>A fax sending application</summary>
7
+    <description><![CDATA[
8
+This application allows sending and receiving faxes in Nextcloud. A phaxio.com account and a real fax number acquired from Phaxio are needed. The 
9
+quality and prices of Phaxio's services are the only reason for using them as a FoIP (fax over IP) provider. The 'libcurl' PHP library has to be present on the server. 
10
+Detailed and complete instructions on how to use this application can be found on the 'Admin documentation' page.
11
+          
12
+Main features:
13
+
14
+* 🚀 Multiple documents can be sent in one fax call (up to 20 separate files).
15
+
16
+* 📠 A fax can be sent to multiple fax numbers at once (up to 15 different fax numbers).
17
+
18
+* 📄 Users can send as fax any document in any of the following formats: pdf, doc, docx, odt, jpg, png, tif, tiff, txt, html.
19
+
20
+* 📰 All incoming faxes are received as pdf documents and stored in a Nextcloud folder.
21
+
22
+* 📧 Users receive notifications and (optionally) emails when new faxes arrive.
23
+
24
+* 🔍 All the sent and received faxes are stored in specific Nextcloud folders, so that they can be searched by caller/callee phone number or date.
25
+
26
+* 💻 When they want to send a fax, users can upload files from their computer or choose them directly from Nextcloud.
27
+
28
+* 🔏 Incoming fax requests are checked for authenticity and integrity by verifying Phaxio's signature.
29
+
30
+* 💵 Current Phaxio balance can be always checked by pressing a button on the left panel.
31
+
32
+* 💰 The only ongoing cost is $2 per month for a fax number located in USA or Canada, in a city chosen by the user. No contracts.
33
+
34
+* 💸 Straightforward pricing: $0.07 per sent/received page for faxes to/from USA and Canada and $0.1 per sent/received page for faxes to/from other countries.
35
+
36
+We have no affiliation with Phaxio.
37
+
38
+    ]]></description>
39
+    <version>1.0.4</version>
40
+    <licence>AGPL</licence>
41
+    <author homepage="https://www.doublebastion.com">Double Bastion LLC</author>
42
+    <namespace>PaxFax</namespace>
43
+	<documentation>
44
+		<admin>https://www.doublebastion.com/install-nextcloud/#install-pax-fax</admin>
45
+	</documentation>
46
+    <category>office</category>
47
+    <category>organization</category>
48
+
49
+    <website>https://www.doublebastion.com/pax-fax/</website>
50
+    <bugs>https://git.doublebastion.com/pax-fax/issues/develop</bugs>
51
+    <repository>https://git.doublebastion.com/pax-fax/develop/</repository>
52
+
53
+    <screenshot>https://git.doublebastion.com/pax-fax/raw/develop/img/pax_fax_screenshot.png</screenshot>
54
+
55
+    <dependencies>
56
+            <nextcloud min-version="23" max-version="24" />
57
+    </dependencies>
58
+
59
+    <navigations>
60
+        <navigation>
61
+            <name>Pax Fax</name>
62
+            <route>pax_fax.page.index</route>
63
+            <order>103</order>
64
+            <icon>../img/pax_fax.svg</icon>
65
+        </navigation>
66
+    </navigations>
67
+
68
+    <settings>
69
+            <personal>OCA\PaxFax\Settings\Personal</personal>
70
+            <personal-section>OCA\PaxFax\Settings\PersonalSection</personal-section>
71
+    </settings>
72
+</info>
0 73
new file mode 100644
... ...
@@ -0,0 +1,109 @@
1
+{
2
+    "hashes": {
3
+        "CHANGELOG.txt": "f065741abd95a37e92741ff50ac544af1255e0aaf72f24af042beb8eaa433ed501149d562ea1d8cdf4d3af636bf101878329bad2e67deb5b13e11004a9d155de",
4
+        "COPYING.txt": "a0a86214ea153fb07ff35ceec0848dd1703eae22de036a825efc8394e50f65e3044832f3b49cf7e45a39edc470bdf738abc36a3a78ca7df3a6e73c14eaef94a8",
5
+        "Contributors.txt": "c0d9c3ff52f0f772d28c8750bdcc2ed1cba2ed5eeb4203bb0723149e107f053f36709ac492568128278def8f91d5556e4d5be5b80569b710eb5a840e026fef3c",
6
+        "Phaxio\/composer.json": "15a73bed2e5760f4c4dd1fd60abf746cbd245830ba502884261e9a0b6202844a8a37936e60a2761c6cd94a3054ebdf0c791fb866e191797a9f08227c125f5e4c",
7
+        "Phaxio\/composer.lock": "a6366b124ebbd604e11245e4e01f2f3a6d2bb63bccb861bf2e275f7be7d84d3380447cd9b84afd9dd5da0258cdaa01cdbde0f67ca27f2494d60b9304b092d2f9",
8
+        "Phaxio\/vendor\/autoload.php": "4eeb7a390556c23bed27d39fa0e9921347ccd07a8116f373f1d9ec45e6be608ba526392b6392722fd0aca67b14c8365f45773c50d983218df51f2b221d225761",
9
+        "Phaxio\/vendor\/composer\/ClassLoader.php": "2b6fa585122ace1ba816410acbd8372cb75329917aae6363dbad48e396cca581452616e1386a2e445a8fbb0e461b988279103f4f89adf704bce7726f761abf0e",
10
+        "Phaxio\/vendor\/composer\/InstalledVersions.php": "d7273807c70dea77e8708d58a8368ac9e1cd03a952f5cca0202d469a76d13ae84e17152a52b17768e16f54b18a84963959031c32485166a46b425bb4852b8a2a",
11
+        "Phaxio\/vendor\/composer\/LICENSE": "f3bb64009f41a425df5a9bbab53490f0eb9b74fa8d6aaa2f57efb928edc4ffff330260666edeaa04a91fed708c3663371cf01b284f3a08d6698aaef7a23f355a",
12
+        "Phaxio\/vendor\/composer\/autoload_classmap.php": "38cb0fcac43c6563d0320769be34f7020cecc2d172100930fb5f77043fafae1e1d7467bf681996316e41bb5e5d71a159a02f2b88fa5e067a1fa7883f1f734c79",
13
+        "Phaxio\/vendor\/composer\/autoload_namespaces.php": "e94d2ac452dac5c0a46d259cb9c142ce02d424db8ecd680e16eb604636cbe7b1cff5ce75406b8c99d762952343abfde8a29c3611994c77fb15ad3c9a4d3737f8",
14
+        "Phaxio\/vendor\/composer\/autoload_psr4.php": "1d78c03bc79c82476a9b806cba84ce9067f3dd1a2565f5616f6bcdb0c2eae4ccee33e7267f78a636c9e02904253c024cef43ec01d789918294586d2a1b4654fb",
15
+        "Phaxio\/vendor\/composer\/autoload_real.php": "8e0c72be16830e95bdac7c33043d1ad5144a294dbc28d078563274f379d81e957b2edc400382abd517adc74c0d295ecb606701e4240f55a7303686f424f5432c",
16
+        "Phaxio\/vendor\/composer\/autoload_static.php": "c1abaf9518c87901439bbdba91b10c144ab4fa5263fa35bafba3d56143febc7d045fb281f8fea746e82279c74fe4b22e323a6857cd9fc1ec688e70212546845a",
17
+        "Phaxio\/vendor\/composer\/installed.json": "4cb36f28c497f8d506b8570c0894262a37e98c4327737ed67a963b1ecfa561625a10bf7322e9b0fab7e2401182cc6864e529458ac5d421d8658610479c73cb5e",
18
+        "Phaxio\/vendor\/composer\/installed.php": "2dc2f106f98921818677d17f135455d02ad3946f06dbf85cbecbbef387adbc0d4ffaa53b0fa18697130c53977cccb5a745e69ba3e539fc2ace74997430283a7d",
19
+        "Phaxio\/vendor\/composer\/platform_check.php": "03262b35b0226cd690c4e88d4ac19edfa911b51cd3b49589f6a7d19100a566ee3848d5afedafc68f4dbdf0c1580e98be4bb929195e9e23906fc14d542dc921a1",
20
+        "Phaxio\/vendor\/phaxio\/phaxio\/.gitignore": "60a8620eb13765d26fd63c93217dac4f207ad5b8ee0f5506923f05b72190de5b962dfc76895e968887efe8a17dcd334287bbf0848cc8ba6be0309d6393874fc7",
21
+        "Phaxio\/vendor\/phaxio\/phaxio\/CHANGELOG": "2eff47994cc1ef1ff374ab0e6d63c6504518b2731149c200ed7aa0aa5ea13fef070a7408741426c1c384a298061bc4c53c3dd91ef8eb6c5e4f62894aee1a3206",
22
+        "Phaxio\/vendor\/phaxio\/phaxio\/LICENSE": "a2a7604f0909b0e4b282508198c8e525d239a18995574b54569abd07ba784e872af3757b2a0802e1a8430fcbfe8260eee8f508f3821f29b0fe95ccc7e44874a2",
23
+        "Phaxio\/vendor\/phaxio\/phaxio\/composer.json": "37a15063347f6997ccebacc48942110158f8fd682ac5eb5c58465e3562a9cad346228dec018841d28be3d6afd282f5dce978a22d778f77b75dda05e1cf6a4213",
24
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/autoload.php": "fccd9008107c490da7808c70d27ea04f13ee3de4bde8291a69c3283ebf7b5efc0d0a440aaad0d68ebeadfe37241f924040c977dd0bc93a16b894638211bad1dd",
25
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/cancelFax.php": "590564fdaaef85e7b72b49c31ddc0a5cd9ae70a5c452f1ce4b08f56bec1e19ae9f8c826fe179dd0c68127f96333ddab1faa3d652879e35d27ac5e4b422586c07",
26
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/createPhaxCode.php": "8fd8fe39a97abc99afae8edc9363319bee3ef07841b91f0bc6f738d283a24b2e8e56f109ecd0b4d567e5da694abd4deae14008c1d247dd8690de7ad54e48238e",
27
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/deleteFax.php": "0f14c0147950102848ed065c3ca3f12bb56fad382a35e42f77f0acf67ed491050054bbc43f3ee49a96895d3081156ddbdc7640f3f7d9a0fc7848d13bf4921107",
28
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/downloadFaxDocument.php": "ee26536919405a2e5f4303c69cbaaa66d08eb946143f17dabc8636881b88cb08abdb56812d826424e756efa247dc1c6aeb585ad9f7bfaa21547d0827f4d2e934",
29
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/downloadFaxThumbnail.php": "b581ab76492911decadad4357e6d1cba800394dea1dd0be3ebe925b43b41efc0005ec66707f52ec8a21bcba46f9be0626ff8d08e2686da35e690ebd13302b4db",
30
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/files\/content.pdf": "515cdf6ba8271b7a17bd44e9458e28aa288cd9aee64db2daf721568d0eab1249d47243bfa6b2cf39563e848afa1f246453288682d16ddfd4a0a89c981424dbdc",
31
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/files\/coverPage.html": "8c14d034bd830269ab9df374f6bff8261b4641d121e4c5806c0e923f744e5b0eab82504924e474f04b9218b166edddb5ad1dc42524c64a018e21e9c968f8160a",
32
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/listFaxes.php": "4bd4e16ae654cd39df0f7b405537af034a48c4acee9107dec5fc7f5bb982c2b9cfd6ea030912f0190132664c80fad629bfebb1229d7650200d0ca096a5aabdfe",
33
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/phaxio_config.php.temp": "1efc886fce5ea24e9a650a35c497d45b8bae47bc035c6ce4f58aa2abd78ba46585c0401d8e4cc34614d3521b234d12d539536bc9bfe78a9e980f97f92ff898f9",
34
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/sendContentUrls.php": "f65f864142f8f856d504ddc89f37a570cb3f229563fdeb2a7a56d628c7f4d316c930cd0e4f944cea3c73c0349aba51340f9cf02a174fcdcb7dcf4823ecd4d3c7",
35
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/sendFiles.php": "ae986282c3c75b8e0162bbe95bd08100ce4ec10af67cd536b763e674d9c21a8168948a5f2b1fc3efeb9fd9d9daf46645ffbf179e1e3166ff0060c4ee39edd593",
36
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/sendFilesWithBatching.php": "5e4915fe1fb7fb1c916c776a962aff398ea8c0d3bb753fb0b6edd00ceea8374c8cdc6a528c1e36ee61368d072f8ef549c2ffc62ccff6057088b768d764fe5984",
37
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/sendText.php": "914a594bdd09c08727c9f155945060212f6c03ecf920a9ffe3eeed9ed5ff35547e541a3bd18b242ef47ae356f2c1e55f74b8d790ca077950a07881ae926fa46e",
38
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio.php": "e13f967f4b54f99de59d91fe0dbcf8c653a388825fa1f84f76b391a839941586d38d215f63005fe4307a2a3658afaece45088c002de83f962bb1d936476e9b13",
39
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/AbstractResource.php": "48f68360a03312162d9aae7195345ba848216700f9a7d89f08d681d500d27af715af7d569aaab23b2426867519244d2cbec50fa3db7c8eee897bfd9e43aa30a8",
40
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/AbstractResourceCollection.php": "0365a3e8c6194b51633199d9123aa0789e2279f5b29455c1ae5feb0c01a7731d053ef5252d91f6aa62ac1a4726fa3b906ffffabf9e715f30f9aaa34780367aaa",
41
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/AbstractResources.php": "b22c82110e2f60cdf92c7546f1ec8e8039cb9f4b92298087290c9113698166e9ef7d25b9a2645809e0f2aceb3994e45f4c8904b1a2ca03cf00c05be8504df6bd",
42
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Account.php": "aea5b414544a9c3c7797146c15c4f419d732225de824113ece7a089f26bbc99426f11e980fa7214e4a3065b8efcd1e32ac1d29ea82ebb1eff445e9d27ff6aac0",
43
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Account\/Status.php": "678e00b88f00ce03ce1cdfacd7ff23608baa09f5298bdda06f834d73257b89ba60ced77df88c2604fcc828b5432f2bb7c13e0d5418674b76a5152a59138d8e35",
44
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error.php": "db0e1a32af83054c31662c26b30bef0ce125d0269a3b762ee231af524df152698814fd479db55833f5a7e580a83f6e823130b4b4e81e6635cbcfca796c8154c1",
45
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error\/APIConnectionException.php": "39411737aa1d7c4e8ac656908db977500fb3a5bc9a429e5367341525d010bb48c2785ec9eec0b7d84a244d21182cf0e0f635125a7aef96006a2222cb066ac353",
46
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error\/AuthenticationException.php": "50dc9337d0e0339547d74d49fb608cb9434ec645b16a283f2feef6959de9ebcd0bd0134c113188c8ee4fb06e21a981ed4274670eb0adc51634b1de8c4f3be8ad",
47
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error\/GeneralException.php": "d6d1d96f8ef2d89eff98814befa51b3f0f5a24a44611414c9bbeaf3046633f8a3b752d33b002738ddd5bbde167a1478f897a127e8ec90e710446ca53bf6a2af0",
48
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error\/InvalidRequestException.php": "64988a6943b848b3f74614c27a16c109af76e4cca9df497ee7066b4ccac0719e2665460337b1e03dcc9ebc7d469f0f670c45b680bdf327c8a3ffaecf4e872846",
49
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error\/NotFoundException.php": "cdbe663b94bd2fdef124570af93509a8080312b0ba13e8ac1664744d40a19c9701c35813da6b10f619c6ccd449ba863c012ef2613b24993e59ecb460dd901cf7",
50
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error\/RateLimitException.php": "583aebaa33f59f697795034ea4053919e7203218a6984516ad8ffca8a5eb85a7804a30414b33595016b48ca6b83b1926f5b3eefb4bf8bca5fd88ecf173f0e0d1",
51
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Fax.php": "754cc2e5f039acfd3e6ee98311fb12519d83079bb8acfb21338a0ea175df1b53ae863a709c14e43ae1ef39eddc51bfcaaa577eb284d33da787e511c3abb56df0",
52
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Fax\/File.php": "650cf3c1e6aabd535c13c09de0525d73e695f813f0c267008b7722e7a594b5a25f2156bcf6d9fc0828dc0869fa250c138f55256d8aee6a10d83569f33228ed5e",
53
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/FaxCollection.php": "cd04652b9ff7b19af3d53436ca45cb82db41b611df18473b52cc6eb6f5051ad8db34fe751cec891ab315032f6dd109fff6c430baef95aba11cfae10fc073d2ce",
54
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Faxes.php": "2e1c9c7c78e80fd6efbd49820002c423560bc2fc32d15799b70e26b754a9e659ef61aa707846724c999e1f98ac82366cf57ea49b0ea101a6d825b5bcc80ca278",
55
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/OperationResult.php": "3e85b6a921303cd1e03bc67a79203446e59f76714eed5b468ced130a33fe4e37d6198ef07059fc1f1b8784115ff2084d67e0c3a44b2d7c9433158873c67d7cd9",
56
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxCode.php": "3999628fee6f6f8488e49b8a03a587186a78c20f0ea1a07a5f60455de9dcc8fee644aab86b1942dfeef3b5510de3fa6c71bdf8ee4f2724ddd60309bc09e07fc6",
57
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxCodes.php": "b4d3e68f7c69646cc7e740496173504c8d5ba5956ca43e556c4da1b472500c2937f8ae81fdf8598a7c96899f8e9e9570236cf290547b3a604b0873495a39c4af",
58
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic.php": "9dcb4a790708f552289c28e12de86a5be8af96c1383e079ca626aaba2dc0ae0ac1930c2cc32547d328c69867476746caa7a0c1e9af4b162cee8ea98637720749",
59
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic\/AreaCode.php": "e40391514dc3ac86040436625c8cc977177269d878f97f1f7a26f441b75899fc0ac5f124e82563be63998b5009261287a709630bd5feb7f58d1ca0aff4e799c8",
60
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic\/AreaCodeCollection.php": "36ef6b3a17eaf0bbb45cafd7bc63a387b028c55759e9650c597ed9ad4d98a6788a5c4f2c59055dacaa7ba5cd958f1d8e0811b53962c3b9ad51e96b26ca85e418",
61
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic\/AreaCodes.php": "59b42f33330ad1856d9ecc01588abdcf34080e770f32134cbbf207144d10e1b65c1182df7e39c11f6ba9381fe845715eefd6891cbe29ffc06a8ce2e4e20a3987",
62
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic\/Countries.php": "c3214a5af911c09a2be6de5446c02c6b262082a0cfca057e9a135dbd29631f00a75bfea3bb9181bea1dbe45a7238afd05510275822857031726002ba7d9f2118",
63
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic\/Country.php": "df81c4fd6eaf3d3fd82b090e481cef2c19e34cf532c16753ec909b36c38ac2e87efda4133d8322a512cd0a31d53421fdd2009e6f04be0119a31a90c30c690db5",
64
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic\/CountryCollection.php": "5457c89d54da2c2f6ff8ae907e8c7e21e7fa8197e05c6209d7924e2ac02e422002c6d92e434b45cefe79630532d2c80f1ddd7f4508c0867db637288bc32833c6",
65
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhoneNumber.php": "e8d578db0d72ff22b472c2ecbd58f6b90c06a581392dcb0281b8116dfda57d7fe43d33a212b79d6185276b69ec6c3dadc231603eedb62ded7bd695177baa7b50",
66
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhoneNumberCollection.php": "17e29c72a0a23bf39ab4aca4e77836f78a1a9b570cbece8837e479e2039f8bbf433fe9137c7f9f39e0de930f8eea3eccaf202e6e60cda6ca8fab25e5738af264",
67
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhoneNumbers.php": "0a196164d5abb4598c5f3e4eaf092e999aa2e6d097fa4d93c284757ce5c616d949f07e5a6e9a93f632f838551c5979d6517802243014131f2a6bd20bd64c0246",
68
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/StringUpload.php": "a8e15f97d3562d17375989d34ee31569ae2b7a684632bf64f209e61cac7198ec91cc6668e7be51e1d3cf6110a66e881b20e47d6eac0dd2dc6ba8404f04cd0423",
69
+        "README.md": "d0b6e8e94d3b676c1303b53f3dc7a0839f719b9d26215d3da919e506f31ea353acc1e353a7b3773fff86491a7e4d162a7668f797dc99b91d60897467e9c88b29",
70
+        "appinfo\/info.xml": "ce2854892a8a7b3bfbf78f9f17da514b7825e1cba896545669569689afd63109546cdb6e7889e2ddabb37219a1b0db59d8db1f8b1e7bdd2bcb6b6f34a7710a7d",
71
+        "appinfo\/routes.php": "5c13e06285f7bdea64204c7603ea997220a6bacfef64e74bb676546e7fba262f4a47792c270de13b1fcb454e1759c824517f8af6107af8b877e0a81cf4a250c4",
72
+        "css\/style.css": "b67d92145e3c9784a5ea3f940a1c86d0b25a2e33e0d82d153c4c7c111087bad108d0075dd121f18bb874961eb93cc064d883724e22aee57800f58da4e2c463ed",
73
+        "img\/nextcloud_logo.svg": "4e0d3f0c371d668d83d443e5b1f69f0eedcc759092601d8fe8710dd97b16fd53aa3f9667bba7f305dc3aacfbc14e29b09b78da8b7bf6f41dcb83f5b16473991e",
74
+        "img\/nextcloud_logo_bright.svg": "aeab941556e29f9537508171583bb3309372866122c150c887c21d6a567c5aa06d2653db67c7151b064d4e2fa25f1fc63df21c786ede02ca5f40f12e5c1bad26",
75
+        "img\/pax_fax.svg": "db540b202b0b9e49e0ed2453d99eb23b8eb37c293fcf52de280844e3d3c224ed067cc7bd80db755d851a78fca13fd2721e7bf16727f755de17442fd894b75791",
76
+        "img\/pax_fax_choose_file_from_nextcloud.png": "92d30d5c20d0f03acd9430f4e2c1a3694e346941dc9ec1400fb8a2697b750ddc611d226a55c31d5d3001c1bce2199edfcd823cc2634bb6d050ad0ce4fadaf993",
77
+        "img\/pax_fax_dark.svg": "1cd5df59a2886ada493eedba1ec62dcef815210416cdc1a6bb35aaa3fcaee59f5cd5a756e082557ba95eddd5abcba37236b5fc815cfffd9dea2843614071a673",
78
+        "img\/pax_fax_files_from_pc_and_nextcloud.png": "610c382b47f8ca41898098642538c1ede712a0462442a0eb937110b81befe71833de0a4e74c7f6e798888b51a9b7718108b910c145b7d4bc8096145f835ac556",
79
+        "img\/pax_fax_grey.svg": "fc36143f41b406b237a36e98b5834320bfff94c992a5633508834a8f2db79f679e5b83573d727774f7db6ac5c2eb01fb09b3d42ff1c16fb891f75e9d8a890c17",
80
+        "img\/pax_fax_logo.png": "3c901669e9f2e76f7bb3f2479209f0ff51c24c940d1d5ec163a375464b696c61872bc482dd523560919179cc0af3825d254dd89506220317c9930030896790df",
81
+        "img\/pax_fax_received_fax.png": "42c31af0849badf3d5451ada2d9db869031a48df473a7f4a0c07c1a31bc6c46ad7952612145d4d6037955b015eb90fe8a4115f506fee5d69f3ec46a956333080",
82
+        "img\/pax_fax_received_faxes.png": "ae747393bbbce84696c45aad0d30eb50903dd455f4cb7ba128fd8c5f22aa8d099b2fcc32a2ce58d34ca8bafa5ddd3824e94df68464b36c3d4b6ce56fa85915fe",
83
+        "img\/pax_fax_screenshot.png": "799b5e05469cab56f30cc58f1dc290cc6293fe2e79fef89566cf6feba0418068908d421d5b59eb33570fed2f40bee792fe86a3821e5121b2b204b2daeca516f6",
84
+        "img\/pax_fax_send_uploaded_file_as_fax.png": "536cd0913447bd152049e9cc7793b0674353f2e8b9bd8ae2b5eb7080d24484c4a4aae48f8a8b1ac0a271ed7ff6da2fa19547259a7d5090dbb32febb873ca136c",
85
+        "img\/pax_fax_sent_faxes.png": "d2630afa4992268e9891c66805fb44b21a3c7fbe431f7cc4582ae28b0355821696e8e50304b0165b5208b05a0b7c460f8d2d572d98ec53c3bd99ba08feb17a4e",
86
+        "img\/refresh_logo.svg": "a95a19645bbde5e2146a3ec669950bc6029bfc6104886552eaeb4746733657ecbe4f9199e676ee2e9852ef0c5adb612d93e300e3fa9713fc611e1f8e7c1d5183",
87
+        "js\/sendfax.js": "9e35a608a211aa3fad676d91cfbbe2bbbff0e67fdf86ec165afc0dc03d468c24842bfe42ac2421cf4b2c6b89cecd2cf240f28c88770fd2f69964878e8c565f35",
88
+        "js\/settings.js": "2cd438a40f2388d58b1a4577830906928ba03f08cce2196d4e26f603bd42ad1d0f4fc66607e1b0d279ebea0483a4bb1f8a912c1b7e7b7c3113c0f364ed749e43",
89
+        "js\/tiff.min.js": "c35f67b587aab62db7a3de662779a7b3264d70f5f856142cae88eadd1b477e474977f2b8c5ab31c16be002cb7ca9b52282e6de533b6fd79a02e6d33815919cb4",
90
+        "js\/webodf.min.js": "655acab6a9773314aa741a7477121885c593bf3ecf2bc67adf8f870c81d0604ebf5fc558dc2a6072da0a70397c0d995ce15c5969b2190bcd2b687693772a3281",
91
+        "l10n\/en_GB.js": "91aa74b34d75a800f0ea59635affc02e6efa8e71ed36fa7aaa3fce4046909c669dc8f34740c991469e50bae8b9dff1c5c7bf38d519475de21f197044c6a69b06",
92
+        "l10n\/en_GB.json": "04c7aea39bdbff91d74c0a9b1e788c066c833c6a7fe6c8b770121ded1b20faf47a80312500d103078a10839f72419d8aac78aee91e1734085bb3049365cdadd1",
93
+        "lib\/AppConfig.php": "c8acb61a0d2a4411a468578e4d10dbf1491c259fdfc6f40bfb29b5fae9b2d9dfb3564c72b9c679b5427f37dd51932d17ce6924c4e49daf58c390b6d2076c15b3",
94
+        "lib\/AppInfo\/Application.php": "d4dd88c84a7e53ca402beb53a7794182f04aff7e98a075ebd413369991f8699ec957f356b9f5c319e5bf6e19765bc175f985df0e376e3103ef88b516caf383ff",
95
+        "lib\/Controller\/AuthorApiController.php": "93dfead0d0f6c8bb0c951c1e463454549b981aa0ff8de1cb75059f41d8786d4a4bff721b34a6f764fc27d33bf6f1d10bb950f8fbcc17cf1fa8badebc8b72defe",
96
+        "lib\/Controller\/PageController.php": "c2abb6d62f7118e4c4ff73252c3ac4290e46e252a65248dae12c5a721a1aadeda189835d8efb9c8da7b22b3d8221e928a640bd93e4c5408a2db453517b78cb0d",
97
+        "lib\/Controller\/PaxfaxController.php": "0300d27349431c4853c964be7f38bd95c9269186c0b4a9a391c14cede5e02d8db88f9c4ff923cfcf2beb56ed4808d7b8f7e60a77b21a9ffd3d1403fd7d8572a2",
98
+        "lib\/Migration\/Version100Date20211106170854.php": "3e5872cc17d64b5b9889ba1fcaef6fe8e3baab8535915773257014534cb1c3844d8f13b368a8f6d76bc6474d3f03d9d9eae6f8745edd2675117c2e374c7d8f80",
99
+        "lib\/Service\/PaxfaxService.php": "07f9fc77734cf22c98111bb6cb2a1f84cbaf5841463f4a7dcf1eb38ed7ad60961820858d17938430044201690b5964549831cb46245a74036700fdcbe2f2db7a",
100
+        "lib\/Settings\/Personal.php": "d86bea5200c519db9f6da9c616bcfe7602ec58cd8736ffbd3bec8f213b6bf824b54970a6edfeff2e93daa83835cac1b0dd348253f8ee3e40ef0962e7acead6ed",
101
+        "lib\/Settings\/PersonalSection.php": "f928a8b1df3bd8b482cab7a61cd32cb039ec6b8744f1902bc741c0ca85d0c3473d939df0a1fc91c2bead6b94546a10fa59136e491b142680814bd99ffb05d12b",
102
+        "templates\/content\/index.php": "7f88b793a60d7e3baeb18a22e8f6f6980fe981952871fb4efc1f9d56b4b2fcfc4ac5ef32e03ff227b0c6229cfcfa3a42a12d48c6871d5400a8b4fd68e3d18615",
103
+        "templates\/index.php": "ea041904c7847c95b9e75d60e0328b51a5eb55bd2c45352127d5490f8ee04af5af9b740cd8b71009841c53c1a1ac8de44be01f4744d7273b688d11fa5dd56498",
104
+        "templates\/navigation\/index.php": "95af74754e438a6a99818f5b2f792522a3ed2fd7f674abf741c3f5ae4d811e6b242280cc8d93285b438ef00bc83bf8ea4bb9d275072ff2021a0f1c1db8b720a5",
105
+        "templates\/settings.php": "baf23f8cfff6b68d9b1a8576c589ff66e23009fd5d0e72b9101f6cbb2e8e5666ce49f5be48a2330f3176a0f78ba62db8df8831ba91ee64e25c1e3dacc92151c9"
106
+    },
107
+    "signature": "W5y+PiHVXD1ccxzBetds1\/XLSIxeEP+UiOlZEXtUGfOU1YxTH9JdM1aoLwWbsFNJOIr+rENlUl9eWyHXU07WCu48uR7pE5oZU137lboK\/2\/50VxbN1rreKeJ50OqF5eFl2PCBreJdHufpP91DkuzeUGOKMj1QVx4o2MKVxespeAhoVyv33taidoptawXB5ieZfbdLGXTv+4hx6Dd\/bCQFWth8ivS0EaqKQIzOZkW2eWenRcVoCFfHAnbWSOMV\/CBd28YaEaolKIS7PtN5Iz6wiu0XRWKwT9vd618LYKZYZ62CPonIOjz4DYaMn72NDIvPIoPC7Vd+Ikt5\/2\/iGsLbuvtDUnA0eXS3YmiBhAOOjdL8GPLSF8uf5PkztaHQ2GJTuWUcldFoemx33rs\/f0MIUXbjeEe5CkQLTXuT29umoaqUwxNTrsYUE5t+eqigWDqliK7V9PAPHGWgu7B5ouwDk1ZZUgr6mo09+x4kgVSJlrzQ2xkYwXpHxIMDbVu9ABJSZdNVB1B8nTtqU0aPE\/Na6iGZ8Q+yEqS+PmSuKpJTmvtGBvoppwsA7BWvGf5s+9kMVkJsV\/s8sTv9TU4AmZLMzIUlrZy0RI22TZkkv4OnCeFoOa3kHqzL6SZazBysablrYeBtJnwEKtyHC8GfkIvH7V\/m\/+iHf0uz4hXEhbadnQ=",
108
+    "certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEAjCCAuoCAhG6MA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMjIwMjI1MTU0NTUwWhcNMzIwNjAyMTU0NTUwWjASMRAwDgYD\r\nVQQDDAdwYXhfZmF4MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsa4b\r\nARkaBatWm4JNKsst3BNjt1X4Clo0Vynelj+VfcMK9G2dB02HGZiQhBfi5cvLMDD4\r\nJEw9jPPf+pxxBY87gwloEQxRW4WmI3LLCPNVSF7GfvONwdjsoJebCPnH6AYHbUlG\r\nQ8\/6wlgCiCklMiCWW0pGFQaDis+4KIkmoFS4elRxOzb+oLCsJRHmLIcV1ZipRanE\r\nP5Y1u953glpjMChZEW6\/p4AEB4xi6b+GaQ+8cBZ5+7WvT54l5iKHY6Tl6fwOuBjl\r\nCc+8FC+hIKk7bTSXfbuwpgzZ7RNgH0BYD\/aryxK\/MHAqeGQKM\/pwvH9SN8LMLZVg\r\nXG+25FiBPuiST\/3l42sY1HD+Gh1KIw83zWD\/kVsU8tKIf0t0uS3ntwx3xjH0ojo9\r\n85Pu4XexopIPi4YxNFtphd\/+cJegbSLKa1LL2CqhnPSXHD8GYjZ16qdy6AxEyEki\r\nOQssSlTOsQ2RmvRqDPwqrbIZrVeiN3Mt4qEontOzci4ggjhBWqhjkcRId4XlGveu\r\nAbWP9O8aXzrElLLeSuDzl6uAcrtwgFvYjoxbRH66hcwv\/+RBOK58CI\/0ShGJZyVh\r\n\/9oDKwyYfHT1OTbRKlvm+TfV6Vmbuol0xFinUv4GoykBO67JJcERTSTGGDqMP2OL\r\n97lkR1b7sy9WKrWw1iljbwyzEEASKKleJtp8HC0CAwEAATANBgkqhkiG9w0BAQsF\r\nAAOCAQEAK+uuoq2F0N4nYdHpRRi5pP8hu540jEpHsLB8o\/3GT++Tdj9jeMdfDWos\r\nskB2e+Vi3OgiCWq51gQ9pq0YSQLZJzXBtX9Zd7gvnmIWJZqjbEkMsky+zMM2mweA\r\nl4+coZvXuqxNN6aY+oAKuf66ZWviUld1WEOz0+2vLrhs9qDCYFKDl7vXol6hz4gf\r\nX5d5crNAu1QboE8FEMxqfDrAMeJzL6SAG4UUaF9duB\/6xUm9d7vBKDCPMzZAV\/ob\r\n+8wxt7K4VoOuCo1KEpp\/+ZRrEr5ZbGGsNw41jrtfBsrMtbbIoRtyIh9Xfme2KzYM\r\ncm9HZiMNDokH8MlzOPOGwkP31w4FHQ==\r\n-----END CERTIFICATE-----"
109
+}
0 110
\ No newline at end of file
1 111
new file mode 100644
... ...
@@ -0,0 +1,877 @@
1
+/**
2
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com>
3
+ *
4
+ * @author Double Bastion LLC
5
+ *
6
+ * @license GNU AGPL version 3 or any later version
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
10
+ * License as published by the Free Software Foundation; either
11
+ * version 3 of the License, or any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
17
+ *
18
+ * You should have received a copy of the GNU Affero General Public
19
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+$(document).ready(function() {
24
+
25
+  var userid = "<?php p($userId); ?>";
26
+  var readtxtfile = [];
27
+  var readhtmlfile = [];
28
+  var readjpg = [];
29
+  var readpng = [];
30
+
31
+  // Adjust the path, so that the uploaded pdf files can be previewed while Nextcloud is served on a subdomain or on a subdirectory, by Nginx or by Apache
32
+  var locHref = window.location.href;
33
+  var pathSplit = locHref.split('/');
34
+  var firstPathEl = '';
35
+  if (pathSplit.length == 7) { firstPathEl = '/' + pathSplit[3]; }
36
+
37
+  // Check the available balance
38
+  $("#checkbalance").on("click", function(event) {
39
+
40
+     $('#checkbalance').addClass('icon-loading');
41
+
42
+     var getbalanceUrl = OC.generateUrl("/apps/pax_fax/user/getbalance");
43
+
44
+     $.ajax({
45
+          url: getbalanceUrl + '/' + userid,
46
+          type: "POST",
47
+          data: {userid: userid},
48
+          cache: false,
49
+          processData: false,
50
+          contentType: false,
51
+          success: function(phaxiobalance) {
52
+                 var balanceindlrs = phaxiobalance / 100;
53
+                 var balanceproc = "$ " + balanceindlrs.toFixed(2);
54
+                 $('#currentbalance').text(balanceproc);
55
+
56
+                 $('#checkbalance').removeClass('icon-loading');
57
+          }
58
+     });
59
+  });
60
+
61
+  // Select the Caller ID
62
+  $("#selectcalleridbttn").on("click", function(event) {
63
+
64
+     $('#selectcalleridbttn').addClass('icon-loading');
65
+
66
+     var getfaxnumbersUrl = OC.generateUrl("/apps/pax_fax/user/getfaxnumbers");
67
+     var selectednmbr = null;
68
+
69
+     $.ajax({
70
+          url: getfaxnumbersUrl + '/' + userid,
71
+          type: "POST",
72
+          data: {userid: userid},
73
+          cache: false,
74
+          processData: false,
75
+          contentType: false,
76
+          success: function(phaxionmbrs) {
77
+
78
+                    $('#currentfaxnmbrs').empty();
79
+                    $('#currentfaxnmbrs').append("<option value='' selected='selected' disabled class='optselectfxnb'>Choose an ID</option>");
80
+                    $('#currentfaxnmbrs').append("<option value='' class='optselectfxnb'></option>");
81
+
82
+                    $.each(phaxionmbrs, function(key, indfxnmb) {
83
+                           $('#currentfaxnmbrs').append("<option value='"+indfxnmb+"' class='optselectfxnb'>"+indfxnmb+"</option>");
84
+                    });
85
+
86
+                    $('#selectcalleridbttn').removeClass('icon-loading');
87
+
88
+          }
89
+     });
90
+  });
91
+
92
+  // Clean the Pax_Fax/temp_files directory
93
+  var cleanflUrl = OC.generateUrl("/apps/pax_fax/user/cleantempdir");
94
+
95
+  $.ajax({
96
+          url: cleanflUrl + '/' + userid,
97
+          type: "POST",
98
+          data: {userid: userid},
99
+          cache: false,
100
+          processData: false,
101
+          contentType: false
102
+  });
103
+
104
+  var n = 1;
105
+  var uploadedtofax = [];
106
+  var ordernmbrs = [];
107
+
108
+  // Upload files to be faxed
109
+  $("#uploadfileforfax").change(function(e){
110
+
111
+     OC.msg.startAction("#pf_upload_msg", t("pax_fax", "Uploading ..."));
112
+     $('#faxdocpreview').addClass('icon-loading');
113
+     $('#filestotsize').show();
114
+
115
+     var userid = "<?php p($userId); ?>";
116
+     var baseUrl = OC.generateUrl("/apps/pax_fax/user/uploadfile");
117
+
118
+     var formData = new FormData();
119
+     formData.append('uploadfileforfax', $('#uploadfileforfax')[0].files[0]);
120
+
121
+     var currentflsize = $('#uploadfileforfax')[0].files[0].size;
122
+
123
+     var fileup = $('#uploadfileforfax').val();
124
+     var fileuptrim = fileup.split('\\').pop();
125
+
126
+     if ($.inArray(fileuptrim, uploadedtofax) != -1) {
127
+         var duplicatescheck = 1;
128
+     } else var duplicatescheck = 0;
129
+
130
+     var extension = fileup.replace(/^.*\./, '');
131
+
132
+     if (extension == fileup) {
133
+         extension = "";
134
+     } else {
135
+         extension = extension.toLowerCase();
136
+     }
137
+
138
+     var validExtensions = ["pdf", "doc", "docx", "tif", "tiff", "jpg", "odt", "txt", "html", "png"];
139
+
140
+     if ($.inArray(extension, validExtensions) != -1) {
141
+
142
+       if (duplicatescheck == 0) {
143
+
144
+         if (currentflsize < 20971520) {
145
+
146
+            if (n < 21) {
147
+
148
+               uploadedtofax.push(fileuptrim);
149
+
150
+               $.ajax({
151
+                 url: baseUrl + '/' + userid,
152
+                 type: "POST",
153
+                 data: formData,
154
+                 cache: false,
155
+                 processData: false,
156
+                 contentType: false,
157
+                 success: function(totalflsize) {
158
+
159
+                   $('#filessizetext').text(totalflsize);
160
+
161
+                   // Check if the total file size is over 20 MB
162
+                   var rectotfilesz = parseFloat(totalflsize.replace(" MB", ""));
163
+
164
+                   if (rectotfilesz > 20.00) {
165
+                       $('#filestotsize').css('color', '#ba3555');
166
+                       alert("Error ! You can't send files having a total size of more than 20 MB in one fax call ! Please consider removing files so that the total files size would drop to or below 20 MB");
167
+                       $('#submitfax').attr("disabled", true);
168
+                   } else {
169
+                       $('#submitfax').attr("disabled", false);
170
+                       $('#filestotsize').css('color', '#18bf6e');
171
+                     }
172
+
173
+
174
+                   $('#fileuploadednm').append("<div class='indgenflcls'><div id='"+n+"indfilediv' class='indivflcls'>" + n + ") " + fileuptrim + "</div><div class='indupfldl'>X</div></div><br>");
175
+                   n++;
176
+
177
+                   // Preview the file when you click on its name
178
+                   $("div:visible[id*='indfilediv']").each(function() {
179
+                        $(this).on("click", function(eventclck) {
180
+                           var faxfilenameinit = $(this).text();
181
+                           var faxfilenamesec = faxfilenameinit.substring(faxfilenameinit.indexOf(" ") + 1);
182
+                           var faxfilename = faxfilenamesec.replace("X","");
183
+                           var baseUrl = firstPathEl+"/remote.php/webdav/Pax_Fax/temp_files/"+faxfilename;
184
+                           var extenlst = faxfilename.replace(/^.*\./, '');
185
+
186
+                           if (extenlst == faxfilename) {
187
+                               extenlst = "";
188
+                           } else {
189
+                               extenlst = extenlst.toLowerCase();
190
+                           }
191
+
192
+                           if (extenlst == 'pdf') {
193
+                                  var viewerclick = OC.generateUrl('/apps/files_pdfviewer/?file={file}', {file: baseUrl});
194
+                                  var $iframe = $('<iframe id="docclickview" style="width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:1041;" src="' + viewerclick + '" sandbox="allow-scripts allow-same-origin allow-popups allow-modals"></iframe>');
195
+                                  $("#faxdocpreview").empty();
196
+                                  $("#faxdocpreview").append($iframe);
197
+                           } else if (extenlst == 'txt') {
198
+                                  $("#faxdocpreview").empty();
199
+                                  $("#faxdocpreview").append(readtxtfile[faxfilename]);
200
+                           } else if (extenlst == 'html') {
201
+                                  $("#faxdocpreview").empty();
202
+                                  $("#faxdocpreview").append(readhtmlfile[faxfilename]);
203
+                           } else if (extenlst == 'jpg') {
204
+                                  $("#faxdocpreview").empty();
205
+                                  $("#faxdocpreview").append('<img style="width:100%;height:100%" id="uploadedjpg" src="#" />');
206
+                                  $("#uploadedjpg").attr('src', readjpg[faxfilename]);
207
+                           } else if (extenlst == 'png') {
208
+                                  $("#faxdocpreview").empty();
209
+                                  $("#faxdocpreview").append('<img style="width:100%;height:100%" id="uploadedpng" src="#" />');
210
+                                  $("#uploadedpng").attr('src', readpng[faxfilename]);
211
+                           } else if (extenlst == 'odt') {
212
+                                  $("#faxdocpreview").empty();
213
+                                  function odfInit() {
214
+                                     var odfelement = document.getElementById("faxdocpreview");
215
+                                     odfcanvas = new odf.OdfCanvas(odfelement);
216
+                                     odfcanvas.load(baseUrl);
217
+                                  }
218
+                                  window.setTimeout(odfInit, 0);
219
+                           } else if (extenlst == 'tif' || extenlst == 'tiff') {
220
+                                  var tiffile = '/remote.php/webdav/Pax_Fax/temp_files/'+faxfilename;
221
+                                  var xhr = new XMLHttpRequest();
222
+                                  xhr.responseType = 'arraybuffer';
223
+                                  xhr.open('GET', tiffile);
224
+                                  xhr.onload = function (evnt) {
225
+                                      var tiff = new Tiff({buffer: xhr.response});
226
+                                      var tifcanvas = tiff.toCanvas();
227
+                                      $("#faxdocpreview").empty();
228
+                                      $("#faxdocpreview").append(tifcanvas);
229
+                                  };
230
+                                  xhr.send();
231
+                           }
232
+
233
+                           $("#faxdocpreview").show();
234
+                           $("#faxfoldersview").hide();
235
+                        });
236
+                   });
237
+
238
+                   // Remove uploaded files
239
+                   $('[class*="indupfldl"]').last().click(function() {
240
+
241
+                           var userid = "<?php p($userId); ?>";
242
+                           var baseUrl = OC.generateUrl("/apps/pax_fax/user/removeupfile");
243
+
244
+                           var removedfilenameinit = $(this).closest('[class*="indgenflcls"]').find('[class*="indivflcls"]').text();
245
+
246
+                           var removedfilesplit = removedfilenameinit.split(") ");
247
+                           var removedflnb = parseInt(removedfilesplit[0]);
248
+
249
+                           $(this).closest('[class*="indgenflcls"]').find('[class*="indivflcls"]').hide();
250
+                           $(this).hide();
251
+
252
+                           var removedfilename = removedfilenameinit.substring(removedfilenameinit.indexOf(" ") + 1);
253
+
254
+                           uploadedtofax = $.grep(uploadedtofax, function(value) {
255
+                                           return value != removedfilename;
256
+                           });
257
+
258
+                           $.ajax({
259
+                                   url: baseUrl + '/' + userid,
260
+                                   type: "POST",
261
+                                   data: {removedfilename: removedfilename},
262
+                                   success: function(totalflsize) {
263
+
264
+                                      $('#filessizetext').text(totalflsize);
265
+
266
+                                      // Check file size
267
+                                      var rectotfilesz = parseFloat(totalflsize.replace(" MB", ""));
268
+
269
+                                      if (rectotfilesz > 20.00) {
270
+                                          $('#filestotsize').css('color', '#ba3555');
271
+                                             alert("Error ! You can't send files having a total size of more than 20 MB in one fax call ! Please consider removing files so that the total files size would drop to or below 20 MB");
272
+                                          $('#submitfax').attr("disabled", true);
273
+                                      } else {
274
+                                          $('#submitfax').attr("disabled", false);
275
+                                          $('#filestotsize').css('color', '#18bf6e');
276
+                                        }
277
+
278
+                                      // Rewrite order numbers for files that follow
279
+                                      --n;
280
+                                      $("div:visible[id*='indfilediv']").each(function() {
281
+
282
+                                          var getdivtext =  $(this).text();
283
+                                          var splitdivtext = getdivtext.split(") ");
284
+                                          var currentnbvalue = parseInt(splitdivtext[0]);
285
+                                          var newnbvalue = currentnbvalue - 1;
286
+
287
+                                          if (currentnbvalue > removedflnb) {
288
+                                              var replacedstr = newnbvalue + ") " + splitdivtext[1];
289
+                                              $(this).text(replacedstr);
290
+                                          }
291
+                                      });
292
+
293
+                                      $("div:visible[id*='indflpicked']").each(function() {
294
+
295
+                                          var getdivtext =  $(this).text();
296
+                                          var splitdivtext = getdivtext.split(") ");
297
+                                          var currentnbvalue = parseInt(splitdivtext[0]);
298
+                                          var newnbvalue = currentnbvalue - 1;
299
+
300
+                                          if (currentnbvalue > removedflnb) {
301
+                                              var replacedstr = newnbvalue + ") " + splitdivtext[1];
302
+                                              $(this).text(replacedstr);
303
+                                          }
304
+                                      });
305
+
306
+                                   },
307
+                                   error: function() {
308
+                                          alert('Error !');
309
+                                   }
310
+                           });
311
+
312
+                           $('#faxdocpreview').removeClass('icon-loading');
313
+                           $("#faxdocpreview").empty();
314
+                   });
315
+
316
+                   // Preview the uploaded file
317
+                   var faxfilename = e.target.files[0].name;
318
+                   var baseUrl = firstPathEl+"/remote.php/webdav/Pax_Fax/temp_files/"+faxfilename;
319
+
320
+                   if (extension == 'pdf') {
321
+                              var viewer = OC.generateUrl('/apps/files_pdfviewer/?file={file}', {file: baseUrl});
322
+                              var $iframe = $('<iframe id="docviewer" style="width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:1041;" src="' + viewer + '" sandbox="allow-scripts allow-same-origin allow-popups allow-modals"></iframe>');
323
+                              $("#faxdocpreview").empty();
324
+                              $("#faxdocpreview").append($iframe);
325
+                   } else if (extension == 'txt') {
326
+                              var reader = new FileReader();
327
+                              reader.readAsText(e.target.files[0]);
328
+                              reader.onload = function(e) {
329
+                                  readtxtfile[faxfilename] = e.target.result.replace(/(?:\r\n|\r|\n)/g, '<br>');
330
+                                  $("#faxdocpreview").empty();
331
+                                  $("#faxdocpreview").append(readtxtfile[faxfilename]);
332
+                              };
333
+                   } else if (extension == 'html') {
334
+                              var reader = new FileReader();
335
+                              reader.readAsText(e.target.files[0]);
336
+                              reader.onload = function(e) {
337
+                                  readhtmlfile[faxfilename] = e.target.result.replace(/(?:\r\n|\r|\n)/g, '<br>');
338
+                                  $("#faxdocpreview").empty();
339
+                                  $("#faxdocpreview").append(readhtmlfile[faxfilename]);
340
+                              };
341
+                   } else if (extension == 'jpg') {
342
+                              $("#faxdocpreview").empty();
343
+                              $("#faxdocpreview").append('<img style="width:100%;height:100%" id="uploadedjpg" src="#" />');
344
+
345
+                              var reader = new FileReader();
346
+                              reader.onload = function (e) {
347
+                                  readjpg[faxfilename] = e.target.result;
348
+                                  $("#uploadedjpg").attr('src', readjpg[faxfilename]);
349
+                              }
350
+                              reader.readAsDataURL(e.target.files[0]);
351
+                   } else if (extension == 'png') {
352
+                              $("#faxdocpreview").empty();
353
+                              $("#faxdocpreview").append('<img style="width:100%;height:100%" id="uploadedpng" src="#" />');
354
+
355
+                              var reader = new FileReader();
356
+                              reader.onload = function (e) {
357
+                                  readpng[faxfilename] = e.target.result;
358
+                                  $("#uploadedpng").attr('src', readpng[faxfilename]);
359
+                              }
360
+                              reader.readAsDataURL(e.target.files[0]);
361
+                   } else if (extension == 'odt') {
362
+                              $("#faxdocpreview").empty();
363
+                              function odfInit() {
364
+                                 var odfelement = document.getElementById("faxdocpreview");
365
+                                 odfcanvas = new odf.OdfCanvas(odfelement);
366
+                                 odfcanvas.load(baseUrl);
367
+                              }
368
+                              window.setTimeout(odfInit, 0);
369
+                   } else if (extension == 'tif' || extension == 'tiff') {
370
+                              var tiffile = '/remote.php/webdav/Pax_Fax/temp_files/'+faxfilename;
371
+                              var xhr = new XMLHttpRequest();
372
+                              xhr.responseType = 'arraybuffer';
373
+                              xhr.open('GET', tiffile);
374
+                              xhr.onload = function (e) {
375
+                                  var tiff = new Tiff({buffer: xhr.response});
376
+                                  var tifcanvas = tiff.toCanvas();
377
+                                  $("#faxdocpreview").empty();
378
+                                  $("#faxdocpreview").append(tifcanvas);
379
+                              };
380
+                              xhr.send();
381
+                   }
382
+
383
+                   $("#faxdocpreview").show();
384
+                   $('#pf_upload_msg').hide();
385
+                   $('#faxdocpreview').removeClass('icon-loading');
386
+                   $("#faxfoldersview").hide();
387
+                 },
388
+                 error: function(data){
389
+                     alert('Error!');
390
+                 }
391
+               });
392
+
393
+            } else {
394
+                  alert("Error ! You can't send as fax more than 20 files in one fax call !");
395
+                  $('#pf_upload_msg').hide();
396
+                  $('#faxdocpreview').removeClass('icon-loading');
397
+              }
398
+         } else {
399
+              alert("Error ! You can't send files having a total size of more than 20 MB in one fax call !");
400
+              $('#pf_upload_msg').hide();
401
+              $('#faxdocpreview').removeClass('icon-loading');
402
+           }
403
+       } else {
404
+            alert("Error ! There is already a file named '"+fileuptrim+"' in the 'Pax_Fax/temp_files' folder !");
405
+            $('#pf_upload_msg').hide();
406
+            $('#faxdocpreview').removeClass('icon-loading');
407
+         }
408
+
409
+     } else {
410
+          alert('The file type is not supported ! Supported formats are: pdf, doc, docx, tif, tiff, jpg, odt, txt, html, png.');
411
+          $('#pf_upload_msg').hide();
412
+          $('#faxdocpreview').removeClass('icon-loading');
413
+       }
414
+  });
415
+
416
+
417
+  // Pick file to fax, from Nextcloud
418
+  var faxfilename = null;
419
+
420
+  $("#choosefilen").on("click", function(evn) {
421
+
422
+                OC.dialogs.filepicker(
423
+                        t('settings', "Select a file to send as fax."),
424
+                        function (path) {
425
+
426
+                              OC.msg.startAction("#pf_choose_msg", t("pax_fax", "Please wait ..."));
427
+                              $('#faxdocpreview').addClass('icon-loading');
428
+                              $('#filestotsize').show();
429
+
430
+                              var userid = "<?php p($userId); ?>";
431
+                              var baseUrl = OC.generateUrl("/apps/pax_fax/user/pickfile");
432
+
433
+                              faxfilename = path.split('/').pop();
434
+
435
+                              if ($.inArray(faxfilename, uploadedtofax) != -1) {
436
+                                  var duplicatescheck = 1;
437
+                              } else var duplicatescheck = 0;
438
+
439
+                              var extension = faxfilename.replace(/^.*\./, '');
440
+
441
+                              if (extension == faxfilename) {
442
+                                  extension = "";
443
+                              } else {
444
+                                  extension = extension.toLowerCase();
445
+                              }
446
+
447
+                              var validExtensions = ["pdf", "doc", "docx", "tif", "tiff", "jpg", "odt", "txt", "html", "png"];
448
+
449
+                              if ($.inArray(extension, validExtensions) != -1) {
450
+
451
+                                 if (duplicatescheck == 0) {
452
+
453
+                                    if (n < 21) {
454
+
455
+                                       uploadedtofax.push(faxfilename);
456
+
457
+                                       $.ajax({
458
+                                          url: baseUrl + '/' + userid,
459
+                                          type: "POST",
460
+                                          data: {path: path},
461
+                                          success: function(totalflsize) {
462
+
463
+                                                $('#filessizetext').text(totalflsize);
464
+
465
+                                                // Check if the total file size is over 20 MB
466
+                                                var rectotfilesz = parseFloat(totalflsize.replace(" MB", ""));
467
+
468
+                                                if (rectotfilesz > 20.00) {
469
+                                                    $('#filestotsize').css('color', '#ba3555');
470
+                                                    alert("Error ! You can't send files having a total size of more than 20 MB in one fax call ! Please consider removing files so that the total files size would drop to or below 20 MB");
471
+                                                    $('#submitfax').attr("disabled", true);
472
+                                                } else {
473
+                                                    $('#submitfax').attr("disabled", false);
474
+                                                    $('#filestotsize').css('color', '#18bf6e');
475
+                                                }
476
+
477
+                                                $('#filespickednc').append("<div class='indgenpckfls'><div id='"+n+"indflpicked' class='indivflpckd'>" + n + ") " + faxfilename + "</div><div class='indpckfldl'>X</div></div><br>");
478
+                                                n++;
479
+
480
+                                                $("div:visible[id*='indflpicked']").each(function() {
481
+                                                   $(this).on("click", function(event) {
482
+                                                      var faxfilenameinit = $(this).text();
483
+                                                      var faxfilenamesec = faxfilenameinit.substring(faxfilenameinit.indexOf(" ") + 1);
484
+                                                      var faxfilenamesp = faxfilenamesec.replace("X","");
485
+                                                      var baseUrl = firstPathEl+"/remote.php/webdav/Pax_Fax/temp_files/"+faxfilenamesp;
486
+                                                      var extenlst = faxfilenamesp.replace(/^.*\./, '');
487
+
488
+                                                      if (extenlst == faxfilenamesp) {
489
+                                                           extenlst = "";
490
+                                                      } else {
491
+                                                           extenlst = extenlst.toLowerCase();
492
+                                                      }
493
+
494
+                                                      if (extenlst == 'pdf') {
495
+                                                           var viewerclick = OC.generateUrl('/apps/files_pdfviewer/?file={file}', {file: baseUrl});
496
+                                                           var $iframe = $('<iframe id="docclickview" style="width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:1041;" src="' + viewerclick + '" sandbox="allow-scripts allow-same-origin allow-popups allow-modals"></iframe>');
497
+                                                           $("#faxdocpreview").empty();
498
+                                                           $("#faxdocpreview").append($iframe);
499
+                                                      } else if (extenlst == 'txt') {
500
+                                                              $("#faxdocpreview").empty();
501
+                                                              $("#faxdocpreview").append(readtxtfile[faxfilenamesp]);
502
+                                                      } else if (extenlst == 'html') {
503
+                                                              $("#faxdocpreview").empty();
504
+                                                              $("#faxdocpreview").append(readhtmlfile[faxfilenamesp]);
505
+                                                      } else if (extenlst == 'jpg') {
506
+                                                              $("#faxdocpreview").empty();
507
+                                                              $("#faxdocpreview").append('<img style="width:100%;height:100%" id="uploadedjpg" src="#" />');
508
+                                                              $("#uploadedjpg").attr('src', readjpg[faxfilenamesp]);
509
+                                                      } else if (extenlst == 'png') {
510
+                                                              $("#faxdocpreview").empty();
511
+                                                              $("#faxdocpreview").append('<img style="width:100%;height:100%" id="uploadedpng" src="#" />');
512
+                                                              $("#uploadedpng").attr('src', readpng[faxfilenamesp]);
513
+                                                      } else if (extenlst == 'odt') {
514
+                                                              $("#faxdocpreview").empty();
515
+                                                              function odfInit() {
516
+                                                                 var odfelement = document.getElementById("faxdocpreview");
517
+                                                                 odfcanvas = new odf.OdfCanvas(odfelement);
518
+                                                                 odfcanvas.load(baseUrl);
519
+                                                              }
520
+                                                              window.setTimeout(odfInit, 0);
521
+                                                      } else if (extenlst == 'tif' || extenlst == 'tiff') {
522
+                                                              var tiffile = '/remote.php/webdav/Pax_Fax/temp_files/'+faxfilenamesp;
523
+                                                              var xhr = new XMLHttpRequest();
524
+                                                              xhr.responseType = 'arraybuffer';
525
+                                                              xhr.open('GET', tiffile);
526
+                                                              xhr.onload = function (evnt) {
527
+                                                                  var tiff = new Tiff({buffer: xhr.response});
528
+                                                                  var tifcanvas = tiff.toCanvas();
529
+                                                                  $("#faxdocpreview").empty();
530
+                                                                  $("#faxdocpreview").append(tifcanvas);
531
+                                                              };
532
+                                                              xhr.send();
533
+                                                      }
534
+
535
+                                                      $("#faxdocpreview").show();
536
+                                                      $("#faxfoldersview").hide();
537
+                                                   });
538
+                                                });
539
+
540
+                                                // Remove picked files
541
+                                                $('[class*="indpckfldl"]').last().click(function() {
542
+                                                    var userid = "<?php p($userId); ?>";
543
+                                                    var baseUrl = OC.generateUrl("/apps/pax_fax/user/removeupfile");
544
+
545
+                                                    var removedfilenameinit = $(this).closest('[class*="indgenpckfls"]').find('[class*="indivflpckd"]').text();
546
+
547
+                                                    var removedfilesplit = removedfilenameinit.split(") ");
548
+                                                    var removedflnb = parseInt(removedfilesplit[0]);
549
+
550
+                                                    $(this).closest('[class*="indgenpckfls"]').find('[class*="indivflpckd"]').hide();
551
+                                                    $(this).hide();
552
+                                                    var removedfilename = removedfilenameinit.substring(removedfilenameinit.indexOf(" ") + 1);
553
+
554
+                                                    uploadedtofax = $.grep(uploadedtofax, function(value) {
555
+                                                             return value != removedfilename;
556
+                                                    });
557
+
558
+                                                    $.ajax({
559
+                                                        url: baseUrl + '/' + userid,
560
+                                                        type: "POST",
561
+                                                        data: {removedfilename: removedfilename},
562
+                                                        success: function(totalflsize) {
563
+
564
+                                                             $('#filessizetext').text(totalflsize);
565
+
566
+                                                             // Check file size
567
+                                                             var rectotfilesz = parseFloat(totalflsize.replace(" MB", ""));
568
+
569
+                                                             if (rectotfilesz > 20.00) {
570
+                                                                 $('#filestotsize').css('color', '#ba3555');
571
+                                                                 alert("Error ! You can't send files having a total size of more than 20 MB in one fax call ! Please consider removing files so that the total files size would drop at or below 20 MB");
572
+                                                                 $('#submitfax').attr("disabled", true);
573
+                                                             } else {
574
+                                                                 $('#submitfax').attr("disabled", false);
575
+                                                                 $('#filestotsize').css('color', '#18bf6e');
576
+                                                               }
577
+
578
+                                                             // Rewrite order numbers for files that follow
579
+                                                             --n;
580
+                                                             $("div:visible[id*='indflpicked']").each(function() {
581
+
582
+                                                                  var getdivtext =  $(this).text();
583
+                                                                  var splitdivtext = getdivtext.split(") ");
584
+                                                                  var currentnbvalue = parseInt(splitdivtext[0]);
585
+                                                                  var newnbvalue = currentnbvalue - 1;
586
+
587
+                                                                  if (currentnbvalue > removedflnb) {
588
+                                                                      var replacedstr = newnbvalue + ") " + splitdivtext[1];
589
+                                                                      $(this).text(replacedstr);
590
+                                                                  }
591
+                                                             });
592
+                                                        },
593
+                                                        error: function() {
594
+                                                             alert('Error !');
595
+                                                        }
596
+                                                    });
597
+
598
+                                                    $('#faxdocpreview').removeClass('icon-loading');
599
+                                                    $("#faxdocpreview").empty();
600
+                                                });
601
+
602
+                                          // Preview the picked file
603
+                                          var flUrl = firstPathEl+"/remote.php/webdav/Pax_Fax/temp_files/"+faxfilename;
604
+                                          var pickUrl = OC.generateUrl("/apps/pax_fax/user/getpickedfile");
605
+
606
+                                          if (extension == 'pdf') {
607
+                                              var viewer = OC.generateUrl('/apps/files_pdfviewer/?file={file}', {file: flUrl});
608
+                                              var $iframe = $('<iframe id="docviewer" style="width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:1041;" src="' + viewer + '" sandbox="allow-scripts allow-same-origin allow-popups allow-modals"></iframe>');
609
+                                              $("#faxdocpreview").empty();
610
+                                              $("#faxdocpreview").append($iframe);
611
+                                          } else if (extension == 'txt') {
612
+
613
+                                              $.ajax({
614
+                                                  url: pickUrl + '/' + userid,
615
+                                                  type: "POST",
616
+                                                  data: {pickedfilename: faxfilename},
617
+                                                  success: function(getpickedfile) {
618
+                                                      readtxtfile[faxfilename] = getpickedfile.replace(/(?:\r\n|\r|\n)/g, '<br>');
619
+                                                      $("#faxdocpreview").empty();
620
+                                                      $("#faxdocpreview").append(readtxtfile[faxfilename]);
621
+                                                  },
622
+                                                  error: function() {
623
+                                                      alert('Unexpected error !');
624
+                                                  }
625
+                                              });
626
+
627
+                                          } else if (extension == 'html') {
628
+
629
+                                              $.ajax({
630
+                                                  url: pickUrl + '/' + userid,
631
+                                                  type: "POST",
632
+                                                  data: {pickedfilename: faxfilename},
633
+                                                  success: function(getpickedfile) {
634
+                                                      readhtmlfile[faxfilename] = getpickedfile.replace(/(?:\r\n|\r|\n)/g, '<br>');
635
+                                                      $("#faxdocpreview").empty();
636
+                                                      $("#faxdocpreview").append(readhtmlfile[faxfilename]);
637
+                                                  },
638
+                                                  error: function() {
639
+                                                      alert('Unexpected error !');
640
+                                                  }
641
+                                              });
642
+
643
+                                          } else if (extension == 'jpg') {
644
+
645
+                                              $.ajax({
646
+                                                  url: pickUrl + '/' + userid,
647
+                                                  type: "POST",
648
+                                                  data: {pickedfilename: faxfilename},
649
+                                                  success: function(getpickedfile) {
650
+                                                      $("#faxdocpreview").empty();
651
+                                                      $("#faxdocpreview").append('<img style="width:100%;height:100%" id="uploadedjpg" src="#" />');
652
+                                                      readjpg[faxfilename] = getpickedfile;
653
+                                                      $("#uploadedjpg").attr('src', readjpg[faxfilename]);
654
+                                                  },
655
+                                                  error: function() {
656
+                                                      alert('Unexpected error !');
657
+                                                  }
658
+                                              });
659
+
660
+                                          } else if (extension == 'png') {
661
+
662
+                                              $.ajax({
663
+                                                  url: pickUrl + '/' + userid,
664
+                                                  type: "POST",
665
+                                                  data: {pickedfilename: faxfilename},
666
+                                                  success: function(getpickedfile) {
667
+                                                      $("#faxdocpreview").empty();
668
+                                                      $("#faxdocpreview").append('<img style="width:100%;height:100%" id="uploadedpng" src="#" />');
669
+                                                      readpng[faxfilename] = getpickedfile;
670
+                                                      $("#uploadedpng").attr('src', readpng[faxfilename]);
671
+                                                  },
672
+                                                  error: function() {
673
+                                                      alert('Unexpected error !');
674
+                                                  }
675
+                                              });
676
+
677
+                                          } else if (extension == 'odt') {
678
+                                              $("#faxdocpreview").empty();
679
+                                              function odfInit() {
680
+                                                  var odfelement = document.getElementById("faxdocpreview");
681
+                                                  odfcanvas = new odf.OdfCanvas(odfelement);
682
+                                                  odfcanvas.load(flUrl);
683
+                                               }
684
+                                               window.setTimeout(odfInit, 0);
685
+
686
+                                          } else if (extension == 'tif' || extension == 'tiff') {
687
+                                               var tiffile = '/remote.php/webdav/Pax_Fax/temp_files/'+faxfilename;
688
+                                               var xhr = new XMLHttpRequest();
689
+                                               xhr.responseType = 'arraybuffer';
690
+                                               xhr.open('GET', tiffile);
691
+                                               xhr.onload = function (event) {
692
+                                                   var tiff = new Tiff({buffer: xhr.response});
693
+                                                   var tifcanvas = tiff.toCanvas();
694
+                                                   $("#faxdocpreview").empty();
695
+                                                   $("#faxdocpreview").append(tifcanvas);
696
+                                               };
697
+                                               xhr.send();
698
+                                          }
699
+
700
+                                          $("#faxdocpreview").show();
701
+
702
+                                          $('#pf_choose_msg').hide();
703
+                                          $('#faxdocpreview').removeClass('icon-loading');
704
+                                          $("#faxfoldersview").hide();
705
+
706
+                                          },
707
+
708
+                                          error: function(data){
709
+                                             alert('Error!');
710
+                                          }
711
+
712
+                                       });
713
+
714
+                                    } else {
715
+                                        alert("Error ! You can't fax more than 20 files in one fax call !");
716
+                                        $('#pf_choose_msg').hide();
717
+                                        $('#faxdocpreview').removeClass('icon-loading');
718
+                                      }
719
+                                 } else {
720
+                                      alert("Error ! There is already a file named '"+faxfilename+"' in the 'Pax_Fax/temp_files' folder !");
721
+                                      $('#pf_choose_msg').hide();
722
+                                      $('#faxdocpreview').removeClass('icon-loading');
723
+                                   }
724
+
725
+                              } else {
726
+                                   alert('The file type is not supported ! Supported formats are: pdf, doc, docx, tif, tiff, jpg, odt, txt, html, png.');
727
+                                   $('#pf_choose_msg').hide();
728
+                                   $('#faxdocpreview').removeClass('icon-loading');
729
+                                }
730
+
731
+                        }
732
+                );
733
+  });
734
+
735
+
736
+  // Submit the fax
737
+  $("#submitfax").on("click", function(event){
738
+
739
+     var selectedcid = $('#currentfaxnmbrs :selected').text();
740
+
741
+     var toNumberinit = $('#faxto').val();
742
+     var toNumbersec = toNumberinit.replace(/[^0-9,]/g, "");
743
+     var toNumber = toNumbersec.split(",");
744
+
745
+     for(var v = 0; v < toNumber.length; v++) {
746
+         toNumber[v] = "+" + toNumber[v];
747
+     }
748
+
749
+     OC.msg.startAction("#pf_submit_msg", t("pax_fax", "Sending fax ... Please wait !"));
750
+     $('#faxdocpreview').addClass('icon-loading');
751
+
752
+     var userid = "<?php p($userId); ?>";
753
+     var baseUrl = OC.generateUrl("/apps/pax_fax/user/sendfax");
754
+
755
+     var toNumberwc = toNumberinit.replace(/[^0-9]/g, "");
756
+
757
+         if (uploadedtofax.length != 0) {
758
+
759
+           if (toNumberwc != '') {
760
+
761
+             $.ajax({
762
+                url: baseUrl + '/' + userid,
763
+                type: "POST",
764
+                data: {uploadedtofax: uploadedtofax,
765
+                       selectedcid: selectedcid,
766
+                       toNumber: toNumber
767
+                      },
768
+                success: function(phaxioresult) {
769
+
770
+                   if (phaxioresult.success == true) {
771
+                       alert("The fax has been sent successfully ! You can see the sent fax by clicking on the 'Sent Faxes' button.");
772
+                   } else {
773
+                       alert("Error ! The fax couldn't be sent because of the following error: "+phaxioresult.errortype+" You can see the failed fax by clicking on the 'Failed Sent Faxes' button.");
774
+                   }
775
+
776
+                   $("div:visible[id*='indfilediv']").hide();
777
+                   $("div:visible[id*='indflpicked']").hide();
778
+                   $('[class*="indupfldl"]').hide();
779
+                   $('[class*="indpckfldl"]').hide();
780
+
781
+                   $('#faxdocpreview').hide();
782
+
783
+                   $('#filestotsize').hide();
784
+                   $('#submitfax').attr("disabled", true);
785
+                   $("#receivedfaxdir").attr("disabled", true);
786
+                   $("#sentfaxdir").attr("disabled", true);
787
+                   $("#receivedfaileddir").attr("disabled", true);
788
+                   $("#sentfaileddir").attr("disabled", true);
789
+
790
+                   location.reload(true);
791
+
792
+                },
793
+
794
+                error: function(phaxioresult) {
795
+
796
+                   alert('Error ! Please check your settings !');
797
+
798
+                   $("div:visible[id*='indfilediv']").hide();
799
+                   $("div:visible[id*='indflpicked']").hide();
800
+                   $('[class*="indupfldl"]').hide();
801
+                   $('[class*="indpckfldl"]').hide();
802
+
803
+                   $('#pf_submit_msg').hide();
804
+                   $('#filestotsize').hide();
805
+                   $('#faxdocpreview').hide();
806
+                   $('#submitfax').attr("disabled", true);
807
+
808
+
809
+                   $("#receivedfaxdir").attr("disabled", true);
810
+                   $("#sentfaxdir").attr("disabled", true);
811
+                   $("#receivedfaileddir").attr("disabled", true);
812
+                   $("#sentfaileddir").attr("disabled", true);
813
+
814
+                          location.reload(true);
815
+                }
816
+             });
817
+           } else {
818
+              $('#pf_submit_msg').hide();
819
+              $('#faxdocpreview').removeClass('icon-loading');
820
+              alert("Please enter the fax number of the recipient !");
821
+             }
822
+         } else {
823
+              $('#pf_submit_msg').hide();
824
+              $('#faxdocpreview').removeClass('icon-loading');
825
+              alert("Please upload a file or pick a file from Nextcloud to send as fax !");
826
+           }
827
+  });
828
+
829
+  $("#receivedfaxdir").on("click", function(event){
830
+     $("#faxdocpreview").hide();
831
+     $("#faxfoldersview").show();
832
+     $("#faxfoldersview").addClass("icon-loading");
833
+     $("#faxfoldersview :last-child").remove();
834
+     var fxreceived = OC.generateUrl("/apps/files/?dir=/Pax_Fax/faxes_received");
835
+     $("#faxfoldersview").append("<iframe id='embeddedView' src='" + fxreceived + "' width='100%' height='100%'></iframe>");
836
+     setTimeout(function() { $("#faxfoldersview").removeClass("icon-loading"); }, 1000);
837
+  });
838
+
839
+  $("#sentfaxdir").on("click", function(event){
840
+     $("#faxdocpreview").hide();
841
+     $("#faxfoldersview").show();
842
+     $("#faxfoldersview").addClass("icon-loading");
843
+     $("#faxfoldersview :last-child").remove();
844
+     var fxsent = OC.generateUrl("/apps/files/?dir=/Pax_Fax/faxes_sent");
845
+     $("#faxfoldersview").append("<iframe id='embeddedView' src='" + fxsent + "' width='100%' height='100%'></iframe>");
846
+     setTimeout(function() { $("#faxfoldersview").removeClass("icon-loading"); }, 1000);
847
+  });
848
+
849
+  $("#receivedfaileddir").on("click", function(event){
850
+     $("#faxdocpreview").hide();
851
+     $("#faxfoldersview").show();
852
+     $("#faxfoldersview").addClass("icon-loading");
853
+     $("#faxfoldersview :last-child").remove();
854
+     var fxrecfailed = OC.generateUrl("/apps/files/?dir=/Pax_Fax/faxes_received_failed");
855
+     $("#faxfoldersview").append("<iframe id='embeddedView' src='" + fxrecfailed + "' width='100%' height='100%'></iframe>");
856
+     setTimeout(function() { $("#faxfoldersview").removeClass("icon-loading"); }, 1000);
857
+  });
858
+
859
+  $("#sentfaileddir").on("click", function(event){
860
+     $("#faxdocpreview").hide();
861
+     $("#faxfoldersview").show();
862
+     $("#faxfoldersview").addClass("icon-loading");
863
+     $("#faxfoldersview :last-child").remove();
864
+     var fxsentfailed = OC.generateUrl("/apps/files/?dir=/Pax_Fax/faxes_received_failed");
865
+     $("#faxfoldersview").append("<iframe id='embeddedView' src='" + fxsentfailed + "' width='100%' height='100%'></iframe>");
866
+     setTimeout(function() { $("#faxfoldersview").removeClass("icon-loading"); }, 1000);
867
+  });
868
+
869
+  $(".indivflpckd").click(function(event){
870
+     $("#faxfoldersview").hide();
871
+  });
872
+
873
+  $(".indivflcls").on("click", function(event){
874
+     $("#faxfoldersview").hide();
875
+  });
876
+
877
+});
0 878
new file mode 100644
... ...
@@ -0,0 +1,95 @@
1
+<?php
2
+/**
3
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com>
4
+ *
5
+ * @author Double Bastion LLC
6
+ *
7
+ * @license GNU AGPL version 3 or any later version
8
+ *
9
+ * This program is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
11
+ * License as published by the Free Software Foundation; either
12
+ * version 3 of the License, or any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
18
+ *
19
+ * You should have received a copy of the GNU Affero General Public
20
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ */
23
+
24
+declare(strict_types=1);
25
+
26
+script('pax_fax', 'settings');
27
+style('pax_fax', 'style');
28
+
29
+?>
30
+
31
+<div id="pax_fax_adm">
32
+	<div class="section">
33
+           <h2><?php p($l->t('Pax Fax'));?></h2>
34
+	   <p id="settings-dscr"><h3><?php p($l->t('Please enter your credentials and options in the fields from below:')); ?></h3></p><br>
35
+
36
+           <div class="stp_followupsection">
37
+
38
+                <form id="phaxio_credentials" action="#" >
39
+
40
+                   <p><label for="api_key" class="setlabeltext"><b><?php p($l->t('Phaxio API Key:'));?></b> (Log in to your Phaxio account, click 'API Keys' on the left
41
+                          panel, then, under 'Live Keys' you will find the 'API Key'. Enter the 'API Key' in the field from below):</label></p>
42
+                   <input type="password" class="pax_fax_box" id="api_key" name="api_key" autocomplete="false"
43
+                          placeholder="<?php p($l->t('e.g. d6f172ce92e4f2 ...')); ?>" /><br>
44
+
45
+                   <p><label for="api_secret" class="setlabeltext"><b><?php p($l->t('Phaxio API Secret:'));?></b> (While logged in to your Phaxio account, click 'API Keys' on the left
46
+                          panel, then, under 'Live Keys' you will find the 'API Secret'. Enter the 'API Secret' in the field from below):</label></p>
47
+                   <input type="password" class="pax_fax_box" id="api_secret" name="api_secret" autocomplete="false"
48
+                          placeholder="<?php p($l->t('e.g. 8af589b8ad9579 ...')); ?>" /><br>
49
+
50
+                   <p><label for="webhook_token" class="setlabeltext"><b><?php p($l->t('Phaxio Webhook Token:'));?></b> (While logged in to your Phaxio account, click 'Webhooks' on the
51
+                          left panel, then copy the token found under 'Webhook Token' and enter it in the field from below):</label></p>
52
+                   <input type="password" class="pax_fax_box" id="webhook_token" name="webhook_token" autocomplete="false"
53
+                          placeholder="<?php p($l->t('e.g. b6d90b72ab6cce450025abd46f4d697')); ?>" /><br>
54
+
55
+                   <p><label for="receive_url" class="setlabeltext"><b>Phaxio callback URL for incoming faxes</b> (This URL must have the form:
56
+                          <b>https://<font style="color:#a11a1a;">username</font>:<font
57
+                          style="color:#a11a1a;">6VTGs-c36j4-qK2wm-RgJcl-9pjUD</font>@<font style="color:#a11a1a;">cloud.example.com</font>/apps/pax_fax/api/recfaxphaxio</b> ,
58
+                          where <b><font style="color:#a11a1a;">username</font></b> is the Nextcloud user who has a Phaxio phone number in her/his Phaxio account (Callback
59
+                          URLs can only be configured one per Phaxio phone number. If <b><font style="color:#a11a1a;">username</font></b> contains an <b>@</b> , replace <b>@</b>
60
+                          with <b>&amp;commat;</b> otherwise the URL won't function), <b><font style="color:#a11a1a;">6VTGs-c36j4-qK2wm-RgJcl-9pjUD</font></b> is the 'application
61
+                          password' created for this purpose as explained below, and <b><font style="color:#a11a1a;">cloud.example.com</font></b> is your Nextcloud domain. To
62
+                          create the Nextcloud 'application password' click on the user picture in the upper right corner, then click 'Settings', then, on the left panel, under
63
+                          'Personal' click 'Security', then under 'Devices & sessions', in the 'App name' field enter Pax_Fax, then click the 'Create new app password' button.
64
+                          The password will be displayed only when created. Copy the password, click the 'Done' button, enter the password in the constructed callback URL between ':'
65
+                          and '@' as shown above, copy the entire callback URL to a safe location, then enter the callback URL in the field from below. The next step is to enter the
66
+                          callback URL that you have just created in your Phaxio account: log in to Phaxio, click 'Phone Numbers' on the left panel, click the settings wheel on the
67
+                          row of the phone number for which you want to set up the callback URL, enter the URL in the 'Callback URL' field, then click 'Save'. Also, click on 'Webhooks'
68
+                          on the left panel, then scroll down to 'Webhook Version' and choose 'Version 2.1.0', then click the 'Update' button. Don't forget to also click the 'Save'
69
+                          button at the bottom of this page to save all the settings to the database.)</label></p>
70
+                   <input type="password" class="pax_fax_boxspec" id="receive_url" name="receive_url" autocomplete="false"
71
+                          placeholder="<?php p($l->t('e.g.  https://username:6VTGs-c36j4-qK2wm-RgJcl-9pjUD@cloud.example.com/apps/pax_fax/api/recfaxphaxio')); ?>" /><br><br><br>
72
+
73
+                   <p><label for="get_notification" class="setlabeltext"><b><?php p($l->t('I want to see a notification in Nextcloud when a new fax is received:'));?></b></label></p>
74
+                   <input type="checkbox" class="pax_fax_checkbox" id="get_notification" name="get_notification" autocomplete="false" /><br>
75
+
76
+                       <p>To enable email notifications for every received fax, the "sendmail" utility ("/usr/sbin/sendmail" on Debian Linux),
77
+                          has to be present on the server. "sendmail" is a binary which gets installed when Postfix is installed. Also, the web server user (www-data) has to be allowed to
78
+                          send emails from command line (by specifying "authorized_submit_users = www-data" in "/etc/postfix/main.cf" for Postfix on a Debian based Linux distribution).
79
+                       </p><br>
80
+
81
+                   <p><label for="notification_email" class="setlabeltext"><b><?php p($l->t('I want to receive a notification to the email address from below, when a new fax is received:'));?>
82
+                          </b></label></p>
83
+                   <input type="text" class="pax_fax_box" id="notification_email" name="notification_email" autocomplete="false"
84
+                          placeholder="<?php p($l->t('e.g. john.doe@example.com')); ?>" /><br>
85
+
86
+                   <input type="hidden" id="user_id" name="user_id" />
87
+
88
+                   <input id="save_fax_settings" type="submit" value="<?php p($l->t('Save')) ?>" />
89
+
90
+                   <span id="paxfax_save_msg"></span>
91
+
92
+               </form>
93
+           </div>
94
+        </div>
95
+</div>