Browse Source

Merge with last version of callflows

pull/4/head
Vladimir Barkasov 6 years ago
parent
commit
79e6bb0938
119 changed files with 5454 additions and 2913 deletions
  1. +2
    -0
      src/apps/callflows/.gitattributes
  2. +471
    -0
      src/apps/callflows/LICENSE
  3. +605
    -392
      src/apps/callflows/app.js
  4. +129
    -30
      src/apps/callflows/i18n/en-US.json
  5. +6
    -3
      src/apps/callflows/metadata/app.json
  6. +255
    -93
      src/apps/callflows/style/app.css
  7. BIN
      src/apps/callflows/style/static/images/callflow_help.gif
  8. +1
    -1
      src/apps/callflows/submodules/blacklist/blacklist.css
  9. +47
    -20
      src/apps/callflows/submodules/blacklist/blacklist.js
  10. +1
    -1
      src/apps/callflows/submodules/blacklist/views/addNumber.html
  11. +0
    -0
      src/apps/callflows/submodules/blacklist/views/edit.html
  12. +98
    -68
      src/apps/callflows/submodules/callcenter/callcenter.js
  13. +0
    -0
      src/apps/callflows/submodules/callcenter/views/queue-callflow.html
  14. +0
    -0
      src/apps/callflows/submodules/callcenter/views/queue-edit.html
  15. +0
    -0
      src/apps/callflows/submodules/callcenter/views/queue.html
  16. +0
    -0
      src/apps/callflows/submodules/callcenter/views/user-row.html
  17. +133
    -143
      src/apps/callflows/submodules/conference/conference.js
  18. +0
    -0
      src/apps/callflows/submodules/conference/views/callflowEdit.html
  19. +0
    -0
      src/apps/callflows/submodules/conference/views/edit.html
  20. +368
    -296
      src/apps/callflows/submodules/device/device.js
  21. +0
    -0
      src/apps/callflows/submodules/device/views/callflowEdit.html
  22. +44
    -4
      src/apps/callflows/submodules/device/views/device-ata.html
  23. +0
    -0
      src/apps/callflows/submodules/device/views/device-cellphone.html
  24. +29
    -4
      src/apps/callflows/submodules/device/views/device-fax.html
  25. +0
    -0
      src/apps/callflows/submodules/device/views/device-landline.html
  26. +34
    -4
      src/apps/callflows/submodules/device/views/device-mobile.html
  27. +44
    -29
      src/apps/callflows/submodules/device/views/device-sip_device.html
  28. +0
    -0
      src/apps/callflows/submodules/device/views/device-sip_uri.html
  29. +7
    -0
      src/apps/callflows/submodules/device/views/device-smartphone.html
  30. +41
    -17
      src/apps/callflows/submodules/device/views/device-softphone.html
  31. +0
    -0
      src/apps/callflows/submodules/device/views/entity-element.html
  32. +0
    -0
      src/apps/callflows/submodules/device/views/general_edit.html
  33. +1
    -1
      src/apps/callflows/submodules/directory/directory.css
  34. +160
    -135
      src/apps/callflows/submodules/directory/directory.js
  35. +0
    -0
      src/apps/callflows/submodules/directory/views/callflowEdit.html
  36. +45
    -38
      src/apps/callflows/submodules/directory/views/edit.html
  37. +0
    -0
      src/apps/callflows/submodules/directory/views/userRow.html
  38. +1
    -1
      src/apps/callflows/submodules/faxbox/faxbox.css
  39. +179
    -144
      src/apps/callflows/submodules/faxbox/faxbox.js
  40. +0
    -0
      src/apps/callflows/submodules/faxbox/views/callflowEdit.html
  41. +19
    -3
      src/apps/callflows/submodules/faxbox/views/edit.html
  42. +122
    -78
      src/apps/callflows/submodules/featurecodes/featurecodes.js
  43. +28
    -0
      src/apps/callflows/submodules/featurecodes/views/parking-parkandretrieve.html
  44. +28
    -0
      src/apps/callflows/submodules/featurecodes/views/parking-valet.html
  45. +3
    -3
      src/apps/callflows/submodules/featurecodes/views/view.html
  46. +4
    -0
      src/apps/callflows/submodules/groups/groups.css
  47. +442
    -332
      src/apps/callflows/submodules/groups/groups.js
  48. +0
    -0
      src/apps/callflows/submodules/groups/views/eavesdrop.html
  49. +10
    -10
      src/apps/callflows/submodules/groups/views/edit.html
  50. +8
    -1
      src/apps/callflows/submodules/groups/views/endpoint_row.html
  51. +0
    -0
      src/apps/callflows/submodules/groups/views/intercept.html
  52. +0
    -0
      src/apps/callflows/submodules/groups/views/page_group_dialog.html
  53. +0
    -0
      src/apps/callflows/submodules/groups/views/page_group_element.html
  54. +5
    -0
      src/apps/callflows/submodules/groups/views/ring_group_dialog.html
  55. +0
    -0
      src/apps/callflows/submodules/groups/views/ring_group_element.html
  56. +0
    -0
      src/apps/callflows/submodules/groups/views/ring_group_login_dialog.html
  57. +0
    -0
      src/apps/callflows/submodules/groups/views/ring_group_logout_dialog.html
  58. +76
    -70
      src/apps/callflows/submodules/media/media.js
  59. +5
    -0
      src/apps/callflows/submodules/media/views/callflowEdit.html
  60. +17
    -1
      src/apps/callflows/submodules/media/views/edit.html
  61. +114
    -107
      src/apps/callflows/submodules/menu/menu.js
  62. +0
    -0
      src/apps/callflows/submodules/menu/views/callflowEdit.html
  63. +0
    -0
      src/apps/callflows/submodules/menu/views/callflowKey.html
  64. +0
    -0
      src/apps/callflows/submodules/menu/views/edit.html
  65. +591
    -244
      src/apps/callflows/submodules/misc/misc.js
  66. +240
    -0
      src/apps/callflows/submodules/misc/misc.scss
  67. +0
    -0
      src/apps/callflows/submodules/misc/views/callflow-edit_dialog.html
  68. +0
    -0
      src/apps/callflows/submodules/misc/views/callflowEdit.html
  69. +0
    -0
      src/apps/callflows/submodules/misc/views/check_cid-callflowEdit.html
  70. +0
    -0
      src/apps/callflows/submodules/misc/views/check_cid-childCallflow.html
  71. +0
    -0
      src/apps/callflows/submodules/misc/views/collect-dtmf.html
  72. +0
    -0
      src/apps/callflows/submodules/misc/views/disa.html
  73. +32
    -0
      src/apps/callflows/submodules/misc/views/fax-callflowEdit.html
  74. +0
    -0
      src/apps/callflows/submodules/misc/views/group_pickup.html
  75. +1
    -1
      src/apps/callflows/submodules/misc/views/language.html
  76. +0
    -0
      src/apps/callflows/submodules/misc/views/missedCallAlert-dialog.html
  77. +0
    -0
      src/apps/callflows/submodules/misc/views/pivot.html
  78. +0
    -0
      src/apps/callflows/submodules/misc/views/prepend_cid_callflow.html
  79. +0
    -0
      src/apps/callflows/submodules/misc/views/presence-callflowEdit.html
  80. +0
    -0
      src/apps/callflows/submodules/misc/views/recordCall-callflowEdit.html
  81. +0
    -0
      src/apps/callflows/submodules/misc/views/response.html
  82. +13
    -0
      src/apps/callflows/submodules/misc/views/setAlertEdit.html
  83. +26
    -0
      src/apps/callflows/submodules/misc/views/setcav-dialog.html
  84. +9
    -0
      src/apps/callflows/submodules/misc/views/setcav-row.html
  85. +0
    -0
      src/apps/callflows/submodules/misc/views/sleep.html
  86. +0
    -0
      src/apps/callflows/submodules/misc/views/tts.html
  87. +66
    -0
      src/apps/callflows/submodules/misc/views/webhook-callflowEdit.html
  88. +7
    -3
      src/apps/callflows/submodules/qubicle/qubicle.js
  89. +0
    -0
      src/apps/callflows/submodules/qubicle/views/callflowEdit.html
  90. +15
    -11
      src/apps/callflows/submodules/resource/resource.js
  91. +0
    -0
      src/apps/callflows/submodules/resource/views/account_carrier.html
  92. +1
    -0
      src/apps/callflows/submodules/temporalset/temporalset.css
  93. +12
    -4
      src/apps/callflows/submodules/temporalset/temporalset.js
  94. +0
    -0
      src/apps/callflows/submodules/temporalset/views/callflowEdit.html
  95. +1
    -2
      src/apps/callflows/submodules/timeofday/timeofday.css
  96. +199
    -173
      src/apps/callflows/submodules/timeofday/timeofday.js
  97. +0
    -0
      src/apps/callflows/submodules/timeofday/views/callflowEdit.html
  98. +0
    -0
      src/apps/callflows/submodules/timeofday/views/callflowKey.html
  99. +0
    -0
      src/apps/callflows/submodules/timeofday/views/callflowTimezone.html
  100. +0
    -0
      src/apps/callflows/submodules/timeofday/views/two_column.html

+ 2
- 0
src/apps/callflows/.gitattributes View File

@ -0,0 +1,2 @@
# Set the default behavior, in case people don't have core.autocrlf set
* text=auto

+ 471
- 0
src/apps/callflows/LICENSE View File

@ -0,0 +1,471 @@
MOZILLA PUBLIC LICENSE
Version 1.1
---------------
1. Definitions.
1.0.1. "Commercial Use" means distribution or otherwise making the
Covered Code available to a third party.
1.1. "Contributor" means each entity that creates or contributes to
the creation of Modifications.
1.2. "Contributor Version" means the combination of the Original
Code, prior Modifications used by a Contributor, and the Modifications
made by that particular Contributor.
1.3. "Covered Code" means the Original Code or Modifications or the
combination of the Original Code and Modifications, in each case
including portions thereof.
1.4. "Electronic Distribution Mechanism" means a mechanism generally
accepted in the software development community for the electronic
transfer of data.
1.5. "Executable" means Covered Code in any form other than Source
Code.
1.6. "Initial Developer" means the individual or entity identified
as the Initial Developer in the Source Code notice required by Exhibit
A.
1.7. "Larger Work" means a work which combines Covered Code or
portions thereof with code not governed by the terms of this License.
1.8. "License" means this document.
1.8.1. "Licensable" means having the right to grant, to the maximum
extent possible, whether at the time of the initial grant or
subsequently acquired, any and all of the rights conveyed herein.
1.9. "Modifications" means any addition to or deletion from the
substance or structure of either the Original Code or any previous
Modifications. When Covered Code is released as a series of files, a
Modification is:
A. Any addition to or deletion from the contents of a file
containing Original Code or previous Modifications.
B. Any new file that contains any part of the Original Code or
previous Modifications.
1.10. "Original Code" means Source Code of computer software code
which is described in the Source Code notice required by Exhibit A as
Original Code, and which, at the time of its release under this
License is not already Covered Code governed by this License.
1.10.1. "Patent Claims" means any patent claim(s), now owned or
hereafter acquired, including without limitation, method, process,
and apparatus claims, in any patent Licensable by grantor.
1.11. "Source Code" means the preferred form of the Covered Code for
making modifications to it, including all modules it contains, plus
any associated interface definition files, scripts used to control
compilation and installation of an Executable, or source code
differential comparisons against either the Original Code or another
well known, available Covered Code of the Contributor's choice. The
Source Code can be in a compressed or archival form, provided the
appropriate decompression or de-archiving software is widely available
for no charge.
1.12. "You" (or "Your") means an individual or a legal entity
exercising rights under, and complying with all of the terms of, this
License or a future version of this License issued under Section 6.1.
For legal entities, "You" includes any entity which controls, is
controlled by, or is under common control with You. For purposes of
this definition, "control" means (a) the power, direct or indirect,
to cause the direction or management of such entity, whether by
contract or otherwise, or (b) ownership of more than fifty percent
(50%) of the outstanding shares or beneficial ownership of such
entity.
2. Source Code License.
2.1. The Initial Developer Grant.
The Initial Developer hereby grants You a world-wide, royalty-free,
non-exclusive license, subject to third party intellectual property
claims:
(a) under intellectual property rights (other than patent or
trademark) Licensable by Initial Developer to use, reproduce,
modify, display, perform, sublicense and distribute the Original
Code (or portions thereof) with or without Modifications, and/or
as part of a Larger Work; and
(b) under Patents Claims infringed by the making, using or
selling of Original Code, to make, have made, use, practice,
sell, and offer for sale, and/or otherwise dispose of the
Original Code (or portions thereof).
(c) the licenses granted in this Section 2.1(a) and (b) are
effective on the date Initial Developer first distributes
Original Code under the terms of this License.
(d) Notwithstanding Section 2.1(b) above, no patent license is
granted: 1) for code that You delete from the Original Code; 2)
separate from the Original Code; or 3) for infringements caused
by: i) the modification of the Original Code or ii) the
combination of the Original Code with other software or devices.
2.2. Contributor Grant.
Subject to third party intellectual property claims, each Contributor
hereby grants You a world-wide, royalty-free, non-exclusive license
(a) under intellectual property rights (other than patent or
trademark) Licensable by Contributor, to use, reproduce, modify,
display, perform, sublicense and distribute the Modifications
created by such Contributor (or portions thereof) either on an
unmodified basis, with other Modifications, as Covered Code
and/or as part of a Larger Work; and
(b) under Patent Claims infringed by the making, using, or
selling of Modifications made by that Contributor either alone
and/or in combination with its Contributor Version (or portions
of such combination), to make, use, sell, offer for sale, have
made, and/or otherwise dispose of: 1) Modifications made by that
Contributor (or portions thereof); and 2) the combination of
Modifications made by that Contributor with its Contributor
Version (or portions of such combination).
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
effective on the date Contributor first makes Commercial Use of
the Covered Code.
(d) Notwithstanding Section 2.2(b) above, no patent license is
granted: 1) for any code that Contributor has deleted from the
Contributor Version; 2) separate from the Contributor Version;
3) for infringements caused by: i) third party modifications of
Contributor Version or ii) the combination of Modifications made
by that Contributor with other software (except as part of the
Contributor Version) or other devices; or 4) under Patent Claims
infringed by Covered Code in the absence of Modifications made by
that Contributor.
3. Distribution Obligations.
3.1. Application of License.
The Modifications which You create or to which You contribute are
governed by the terms of this License, including without limitation
Section 2.2. The Source Code version of Covered Code may be
distributed only under the terms of this License or a future version
of this License released under Section 6.1, and You must include a
copy of this License with every copy of the Source Code You
distribute. You may not offer or impose any terms on any Source Code
version that alters or restricts the applicable version of this
License or the recipients' rights hereunder. However, You may include
an additional document offering the additional rights described in
Section 3.5.
3.2. Availability of Source Code.
Any Modification which You create or to which You contribute must be
made available in Source Code form under the terms of this License
either on the same media as an Executable version or via an accepted
Electronic Distribution Mechanism to anyone to whom you made an
Executable version available; and if made available via Electronic
Distribution Mechanism, must remain available for at least twelve (12)
months after the date it initially became available, or at least six
(6) months after a subsequent version of that particular Modification
has been made available to such recipients. You are responsible for
ensuring that the Source Code version remains available even if the
Electronic Distribution Mechanism is maintained by a third party.
3.3. Description of Modifications.
You must cause all Covered Code to which You contribute to contain a
file documenting the changes You made to create that Covered Code and
the date of any change. You must include a prominent statement that
the Modification is derived, directly or indirectly, from Original
Code provided by the Initial Developer and including the name of the
Initial Developer in (a) the Source Code, and (b) in any notice in an
Executable version or related documentation in which You describe the
origin or ownership of the Covered Code.
3.4. Intellectual Property Matters
(a) Third Party Claims.
If Contributor has knowledge that a license under a third party's
intellectual property rights is required to exercise the rights
granted by such Contributor under Sections 2.1 or 2.2,
Contributor must include a text file with the Source Code
distribution titled "LEGAL" which describes the claim and the
party making the claim in sufficient detail that a recipient will
know whom to contact. If Contributor obtains such knowledge after
the Modification is made available as described in Section 3.2,
Contributor shall promptly modify the LEGAL file in all copies
Contributor makes available thereafter and shall take other steps
(such as notifying appropriate mailing lists or newsgroups)
reasonably calculated to inform those who received the Covered
Code that new knowledge has been obtained.
(b) Contributor APIs.
If Contributor's Modifications include an application programming
interface and Contributor has knowledge of patent licenses which
are reasonably necessary to implement that API, Contributor must
also include this information in the LEGAL file.
(c) Representations.
Contributor represents that, except as disclosed pursuant to
Section 3.4(a) above, Contributor believes that Contributor's
Modifications are Contributor's original creation(s) and/or
Contributor has sufficient rights to grant the rights conveyed by
this License.
3.5. Required Notices.
You must duplicate the notice in Exhibit A in each file of the Source
Code. If it is not possible to put such notice in a particular Source
Code file due to its structure, then You must include such notice in a
location (such as a relevant directory) where a user would be likely
to look for such a notice. If You created one or more Modification(s)
You may add your name as a Contributor to the notice described in
Exhibit A. You must also duplicate this License in any documentation
for the Source Code where You describe recipients' rights or ownership
rights relating to Covered Code. You may choose to offer, and to
charge a fee for, warranty, support, indemnity or liability
obligations to one or more recipients of Covered Code. However, You
may do so only on Your own behalf, and not on behalf of the Initial
Developer or any Contributor. You must make it absolutely clear than
any such warranty, support, indemnity or liability obligation is
offered by You alone, and You hereby agree to indemnify the Initial
Developer and every Contributor for any liability incurred by the
Initial Developer or such Contributor as a result of warranty,
support, indemnity or liability terms You offer.
3.6. Distribution of Executable Versions.
You may distribute Covered Code in Executable form only if the
requirements of Section 3.1-3.5 have been met for that Covered Code,
and if You include a notice stating that the Source Code version of
the Covered Code is available under the terms of this License,
including a description of how and where You have fulfilled the
obligations of Section 3.2. The notice must be conspicuously included
in any notice in an Executable version, related documentation or
collateral in which You describe recipients' rights relating to the
Covered Code. You may distribute the Executable version of Covered
Code or ownership rights under a license of Your choice, which may
contain terms different from this License, provided that You are in
compliance with the terms of this License and that the license for the
Executable version does not attempt to limit or alter the recipient's
rights in the Source Code version from the rights set forth in this
License. If You distribute the Executable version under a different
license You must make it absolutely clear that any terms which differ
from this License are offered by You alone, not by the Initial
Developer or any Contributor. You hereby agree to indemnify the
Initial Developer and every Contributor for any liability incurred by
the Initial Developer or such Contributor as a result of any such
terms You offer.
3.7. Larger Works.
You may create a Larger Work by combining Covered Code with other code
not governed by the terms of this License and distribute the Larger
Work as a single product. In such a case, You must make sure the
requirements of this License are fulfilled for the Covered Code.
4. Inability to Comply Due to Statute or Regulation.
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Code due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description
must be included in the LEGAL file described in Section 3.4 and must
be included with all distributions of the Source Code. Except to the
extent prohibited by statute or regulation, such description must be
sufficiently detailed for a recipient of ordinary skill to be able to
understand it.
5. Application of this License.
This License applies to code to which the Initial Developer has
attached the notice in Exhibit A and to related Covered Code.
6. Versions of the License.
6.1. New Versions.
Netscape Communications Corporation ("Netscape") may publish revised
and/or new versions of the License from time to time. Each version
will be given a distinguishing version number.
6.2. Effect of New Versions.
Once Covered Code has been published under a particular version of the
License, You may always continue to use it under the terms of that
version. You may also choose to use such Covered Code under the terms
of any subsequent version of the License published by Netscape. No one
other than Netscape has the right to modify the terms applicable to
Covered Code created under this License.
6.3. Derivative Works.
If You create or use a modified version of this License (which you may
only do in order to apply it to code which is not already Covered Code
governed by this License), You must (a) rename Your license so that
the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
"MPL", "NPL" or any confusingly similar phrase do not appear in your
license (except to note that your license differs from this License)
and (b) otherwise make it clear that Your version of the license
contains terms which differ from the Mozilla Public License and
Netscape Public License. (Filling in the name of the Initial
Developer, Original Code or Contributor in the notice described in
Exhibit A shall not of themselves be deemed to be modifications of
this License.)
7. DISCLAIMER OF WARRANTY.
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
8. TERMINATION.
8.1. This License and the rights granted hereunder will terminate
automatically if You fail to comply with terms herein and fail to cure
such breach within 30 days of becoming aware of the breach. All
sublicenses to the Covered Code which are properly granted shall
survive any termination of this License. Provisions which, by their
nature, must remain in effect beyond the termination of this License
shall survive.
8.2. If You initiate litigation by asserting a patent infringement
claim (excluding declatory judgment actions) against Initial Developer
or a Contributor (the Initial Developer or Contributor against whom
You file such action is referred to as "Participant") alleging that:
(a) such Participant's Contributor Version directly or indirectly
infringes any patent, then any and all rights granted by such
Participant to You under Sections 2.1 and/or 2.2 of this License
shall, upon 60 days notice from Participant terminate prospectively,
unless if within 60 days after receipt of notice You either: (i)
agree in writing to pay Participant a mutually agreeable reasonable
royalty for Your past and future use of Modifications made by such
Participant, or (ii) withdraw Your litigation claim with respect to
the Contributor Version against such Participant. If within 60 days
of notice, a reasonable royalty and payment arrangement are not
mutually agreed upon in writing by the parties or the litigation claim
is not withdrawn, the rights granted by Participant to You under
Sections 2.1 and/or 2.2 automatically terminate at the expiration of
the 60 day notice period specified above.
(b) any software, hardware, or device, other than such Participant's
Contributor Version, directly or indirectly infringes any patent, then
any rights granted to You by such Participant under Sections 2.1(b)
and 2.2(b) are revoked effective as of the date You first made, used,
sold, distributed, or had made, Modifications made by that
Participant.
8.3. If You assert a patent infringement claim against Participant
alleging that such Participant's Contributor Version directly or
indirectly infringes any patent where such claim is resolved (such as
by license or settlement) prior to the initiation of patent
infringement litigation, then the reasonable value of the licenses
granted by such Participant under Sections 2.1 or 2.2 shall be taken
into account in determining the amount or value of any payment or
license.
8.4. In the event of termination under Sections 8.1 or 8.2 above,
all end user license agreements (excluding distributors and resellers)
which have been validly granted by You or any distributor hereunder
prior to termination shall survive termination.
9. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
10. U.S. GOVERNMENT END USERS.
The Covered Code is a "commercial item," as that term is defined in
48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
software" and "commercial computer software documentation," as such
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
all U.S. Government End Users acquire Covered Code with only those
rights set forth herein.
11. MISCELLANEOUS.
This License represents the complete agreement concerning subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. This License shall be governed by
California law provisions (except to the extent applicable law, if
any, provides otherwise), excluding its conflict-of-law provisions.
With respect to disputes in which at least one party is a citizen of,
or an entity chartered or registered to do business in the United
States of America, any litigation relating to this License shall be
subject to the jurisdiction of the Federal Courts of the Northern
District of California, with venue lying in Santa Clara County,
California, with the losing party responsible for costs, including
without limitation, court costs and reasonable attorneys' fees and
expenses. The application of the United Nations Convention on
Contracts for the International Sale of Goods is expressly excluded.
Any law or regulation which provides that the language of a contract
shall be construed against the drafter shall not apply to this
License.
12. RESPONSIBILITY FOR CLAIMS.
As between Initial Developer and the Contributors, each party is
responsible for claims and damages arising, directly or indirectly,
out of its utilization of rights under this License and You agree to
work with Initial Developer and Contributors to distribute such
responsibility on an equitable basis. Nothing herein is intended or
shall be deemed to constitute any admission of liability.
13. MULTIPLE-LICENSED CODE.
Initial Developer may designate portions of the Covered Code as
"Multiple-Licensed". "Multiple-Licensed" means that the Initial
Developer permits you to utilize portions of the Covered Code under
Your choice of the NPL or the alternative licenses, if any, specified
by the Initial Developer in the file described in Exhibit A.
EXHIBIT A -Mozilla Public License.
``The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
The Original Code is ___Monster_____________________________.
The Initial Developer of the Original Code is ___VoIP INC___.
Portions created by ______________________ are Copyright (C) _2015_
_______________________. All Rights Reserved.
Contributor(s): __Jean-Roch Maitre____________________________.
__Maxime Roux______________________________.
__Joris Tirado______________________________.
Alternatively, the contents of this file may be used under the terms
of the _____ license (the "[___] License"), in which case the
provisions of [______] License are applicable instead of those
above. If you wish to allow use of your version of this file only
under the terms of the [____] License and not to allow others to use
your version of this file under the MPL, indicate your decision by
deleting the provisions above and replace them with the notice and
other provisions required by the [___] License. If you do not delete
the provisions above, a recipient may use your version of this file
under either the MPL or the [___] License."
[NOTE: The text of this Exhibit A may differ slightly from the text of
the notices in the Source Code files of the Original Code. You should
use the text of this Exhibit A rather than the text found in the
Original Code Source Code for Your Modifications.]

+ 605
- 392
src/apps/callflows/app.js
File diff suppressed because it is too large
View File


+ 129
- 30
src/apps/callflows/i18n/en-US.json View File

@ -1,6 +1,22 @@
{
"callflowsApp": {
"editor": {
"confirmDialog": {
"enableModule": {
"text": "This action is currently disabled, do you want to enable it?",
"cancel": "No",
"ok": "Yes"
}
},
"moduleBox": {
"tooltip": {
"disabled": "Disabled"
}
}
}
},
"callflows": {
"addCallflow": "Add Callfow",
"addCallflow": "Add Callflow",
"searchDatabase": "Search Database",
"buyNumbers": "Buy Numbers",
"buyLocal": "Local",
@ -152,8 +168,6 @@
"caller_id_number_data_content3": "Define the Caller ID Number of this Device for Emergency Calls.",
"music_on_hold": "Music on Hold",
"music_on_hold_data_content": "Select the media file that you want to be played by default when it's not set on a user or a device.",
"peer_to_peer_audio": "Peer to Peer Audio",
"peer_to_peer_audio_data_content": "Select the kind of Peer-to-Peer that you would like to set on this device",
"secure_rtp": "Secure RTP",
"none": "None",
"srtp": "SRTP",
@ -216,6 +230,19 @@
"mediaWebrtc": {
"content": "If checked, forces a WebRTC compatible SDP on the INVITE.",
"label": "WebRTC"
},
"asserted": "Asserted Identity",
"caller_id_name_data_content4": "Define the Caller ID Name of this Device, to be used for P-Asserted-Identity header (max. 30 chars).",
"caller_id_number_data_content4": "Define the Caller ID Number of this Device, to be used for P-Asserted-Identity header.",
"caller_id_realm": "Caller ID Realm",
"caller_id_realm_placeholder": "Realm",
"caller_id_realm_data_content4": "Define the Caller ID Realm of this Device, to be used for P-Asserted-Identity header.",
"validation": {
"caller_id": {
"name": "Please only enter alphanumeric characters, space or comma",
"number": "Please enter a valid phone number",
"realm": "Please enter a valid realm"
}
}
},
"disa": {
@ -321,6 +348,7 @@
"caller_id": "Caller ID",
"caller_id_placeholder": "Caller ID",
"caller_id_data_content": "Caller ID for this fax box",
"caller_id_no_selected": "- No caller ID -",
"fax_header": "Fax header",
"fax_header_placeholder": "Fax header",
"fax_header_data_content": "Information imprinted on the fax",
@ -425,7 +453,8 @@
"__version": "4.1",
"shoutcastURL": "Stream URL",
"shoutcastURLHelp": "You can type any URL including :// (http, https, shout...)",
"silence": "Silence"
"silence": "Silence",
"shoutcastURLWarning": "WARNING: If the stream selected here attempts to be played, and is unavailable, the call may fail completely. Please make sure the stream you use is available 24/7."
},
"menu": {
"menu": "Menu",
@ -466,7 +495,7 @@
"timeout_for_dialing_data_content": "Number of seconds allowed without pressing any key.",
"extension_number_length": "Extension Number Length",
"length": "Length",
"extension_number_length_data_content": "The maximum length of an extension. By default, it is set to the Record PIN number length.",
"extension_number_length_data_content": "The maximum length of an extension. You can not set a length shorter than the length of the PIN set on this menu (ie: if you set this field to \"2\" but the PIN is set to \"1234\" then the system will automatically set this field to \"4\").",
"allow_outside_recording": "Allow outside recording",
"allow_outside_recording_data_content": "This option allows someone to dial into a menu from an outside number (i.e. their cell phone, landline, etc.) and enter the PIN for the menu to be able to re-record it.",
"suppress_playing_of_invalid_entry": "Suppress playing of Invalid Entry",
@ -572,6 +601,11 @@
"add_time_of_day_label": "Add Time of Day",
"all_other_times": "All other times",
"name_regex": "/^[a-zA-Z0-9\\s_']+$/",
"toastr": {
"warning": {
"missingDay": "Please select at least one day of the week"
}
},
"__comment": "UI-1929: adding time of day sets to options in time of days",
"__version": "4.1",
"types": {
@ -599,7 +633,7 @@
"add_user": "Add a user",
"ring_this_users_devices_for": "Ring this user's devices for",
"seconds": "seconds",
"allow_this_user_to_call_himself": "Allow this user to call himself.",
"allow_this_user_to_call_themselves": "Allow this user to call themselves.",
"when_you_check_this_box": "When you check this box, calls from the user's own extension to themselves will ring the extension. If this box isn't checked, calls from the user's own extension to themselves will go to their voicemail.",
"select_user": "Select User",
"create_user": "Create User",
@ -631,8 +665,6 @@
"email_notifications": "Email Notifications",
"voicemail": "Voicemail",
"voicemail_data_content": "By checking this option, an email will be sent to the specified e-mail address each time this user gets a voicemail.",
"fax": "Fax",
"fax_data_content": "By checking this option, an email will be sent to the specified e-mail address each time you get a Fax.",
"in_house_calls": "In-House Calls",
"caller_id_name": "Caller ID Name",
"caller_id_name_placeholder": "Name",
@ -731,13 +763,23 @@
},
"caller_id": {
"name": "Please only enter alphanumeric characters, space or comma",
"number": "Please enter a valid phone number"
"number": "Please enter a valid phone number",
"realm": "Please enter a valid realm"
}
},
"__version": "4.0",
"__comment": "UI-2475: add a failover option to callforward",
"failover_callforward": "Failover",
"failover_callforward_content": "When checked, if all this user's devices are unregistered, then the system will automatically call-forward (even if the Enable Call-Forward setting isn't enabled)"
"failover_callforward_content": "When checked, if all this user's devices are unregistered, then the system will automatically call-forward (even if the Enable Call-Forward setting isn't enabled)",
"__comment": "UI-2921: adding way to impersonate users",
"__version": "4.2",
"impersonate": "Impersonate",
"asserted": "Asserted Identity",
"caller_id_name_data_content4": "Define the Caller ID Name of this User, to be used for P-Asserted-Identity header (max. 30 chars).",
"caller_id_number_data_content4": "Define the Caller ID Number of this User, to be used for P-Asserted-Identity header.",
"caller_id_realm": "Caller ID Realm",
"caller_id_realm_placeholder": "Realm",
"caller_id_realm_data_content4": "Define the Caller ID Realm of this User, to be used for P-Asserted-Identity header."
},
"vmbox": {
"voicemail": "Voicemail",
@ -783,6 +825,10 @@
"delete_after_notification_data_content": "Delete the voicemail after the notification has been sent",
"not_configurable": "Configurable via menu?",
"not_configurable_data_content": " If unchecked, it will disallow the user to configure voicemail via the menu",
"fast_forward_rewind": "Enable fast-forward and rewind?",
"fast_forward_rewind_data_content": "If enabled, it will allow the user to fast forward and rewind their voicemail messages",
"oldest_message_first": "Sort voicemail box by oldest message first",
"oldest_message_first_data_content": "If enabled, voicemails will be played in order from oldest to newest",
"delete": "Delete",
"save": "Save",
"voicemail_boxes_label": "Voicemail Boxes",
@ -803,19 +849,27 @@
"mp3": "mp3",
"mp4": "mp4",
"wav": "wav",
"default": "Account Default"
"default": "Account Default",
"__comment": "UI-3040: add temporary greeting",
"temporary_unavailable_message": "Temporary Message",
"temporary_unavailable_message_data_content": "Select the Temporary Unavailable message that you want to use for this this device. If you set this field, it will take precedence over the Unavailable message, but if you select - Not set -, then the Unavailable message will be played instead."
},
"__comment": "UI-1493: Adding accountSettings to advanced callflows app",
"__version": "3.22",
"accountSettings": {
"title": "Account Settings",
"callerId": {
"titleOutbound": "Account's Outbound Caller ID",
"titleInbound": "Account's Inbound Caller ID",
"titleOutbound": "Account's External/Off-net Caller ID",
"titleInbound": "Account's Internal/On-net Caller ID",
"titleEmergency": "Account's Emergency Caller ID",
"titleAsserted": "Account's Asserted ID",
"nameLabel": "Caller ID Name:",
"numberLabel": "Caller ID Number:",
"defaultNumber": "Default"
"realmLabel": "Caller ID Realm:",
"defaultNumber": "Default",
"messages": {
"invalidNumber": "Please enter a valid number"
}
},
"musicOnHold": {
"title": "Account's Music on Hold",
@ -828,7 +882,8 @@
"__comment": "UI-2654: Allow shoutcast URL for MoH",
"__version": "v4.1",
"shoutcastURL": "Stream URL",
"shoutcastURLHelp": "You can type any URL including :// (http, https, shout...)"
"shoutcastURLHelp": "You can type any URL including :// (http, https, shout...)",
"shoutcastURLWarning": "WARNING: If the stream selected here attempts to be played, and is unavailable, the call may fail completely. Please make sure the stream you use is available 24/7."
},
"blacklist": {
"title": "Blacklists"
@ -860,6 +915,7 @@
"star_data_content": "The star is mandatory for any feature code, that's why it has been added by default.",
"feature_codes_label": "Feature Codes",
"nothing_to_save": "Nothing to save",
"directed_ext_pickup": "Directed Extension Pickup",
"enable_call_forward": "Enable Call-Forward",
"call_forward_cat": "Call-Forward",
"disable_call_forward": "Disable Call-Forward",
@ -978,6 +1034,15 @@
"selectedUsers": "Selected Users"
},
"setCav": {
"title": "Set CAV",
"popupTitle": "Setting custom application vars",
"tip": "Set Custom Application Var ",
"help": "This feature allows you to set custom application variables providing key/value",
"key": "Key",
"value": "Value"
},
"__comment": "UI-2646: adding ring group togle to adv. callflows",
"__version": "v4.1",
"ringGroupToggle": {
@ -1139,6 +1204,48 @@
"dragAndDropAction": "Drag actions from the actions panel to the callflow box. You can customize a callflow by adding more actions. <div class='callflows-drag-and-drop'></div>",
"nextBtnText": "Next »",
"endTourBtnText": "Close"
},
"__comment": "UI-3210: Add Set Ringtone callflow element",
"setAlertInfo": {
"name": "Distinctive Ring",
"title": "Set Distinctive Ring",
"label": "\"Alert-Info\" Header",
"tip": "Set distinctive ring for incoming call"
},
"webhook": {
"help": "This feature allows you to trigger a webhook call at any level of the callflow, to get \"real time\" info on how the callflow is behaving.",
"popupTitle": "Trigger Webhook",
"title": "Webhook",
"tip": "Trigger a webhook at any level in a callflow to get \"real time\" info on how the callflow is behaving.",
"uri": {
"label": "URL",
"help": "The HTTP URI to send the request",
"errorMessages": {
"url": "Invalid URL"
}
},
"httpVerb": {
"label": "Request Type",
"help": "HTTP method to use when sending the request"
},
"format": {
"label": "Body Format",
"help": "Format to use when sending the webhook ",
"options": {
"formData": "FORM-DATA",
"json": "JSON"
}
},
"retries": {
"label": "Re-try attempts",
"help": "How many times to retry the request if the host isn't available"
},
"customData": {
"label": "Custom data (optional)",
"help": "These properties will be added to the event and will overwrite existing values"
}
}
},
"oldCallflows": {
@ -1147,7 +1254,6 @@
"advanced_cat": "Advanced",
"call_recording_cat": "Call Recording",
"caller_id_cat": "Caller-ID",
"integrations_cat": "Integrations",
"delete_callflow": "Delete callflow",
"save_changes": "Save changes",
"invalid_number": "Invalid number!",
@ -1161,6 +1267,7 @@
"hide_from_contact_list": "Hide from Contact List",
"giving_a_name_to_a_callflow": "Giving a name to a callflow isn't mandatory. Leave the field blank and the callflow will be displayed in the left listing as the list of numbers used in this callflow.",
"popup_title": "Edit Callflow Name",
"callflow_preview_title": "Callflow Preview",
"add_number": "Add number",
"add_a_number": "Add a number",
"available_numbers": "Spare Numbers",
@ -1269,7 +1376,7 @@
"callflow_module_label": "Callflow Module",
"add_callflow_label": "Add Callflow",
"the_owner_of_this_device_is_already": "The owner of this device is already in the ring group. By adding this device, you will remove the User from this ring group. Would you like to continue anyway?",
"this_user_has_already_some_devices": "This user has already some devices belonging to him in this ring group. By adding him to the ring group, you will remove devices that were already in the ring group. Would you like to continue anyway?",
"this_user_has_already_some_devices": "This user has already some devices belonging to them in this ring group. By adding them to the ring group, you will remove devices that were already in the ring group. Would you like to continue anyway?",
"undefined_device": "Undefined Device",
"ring_group_val": "Ring Group - ",
"not_setting_a_pin": "Not setting a PIN is a security risk, are you sure you don\\'t want to set a PIN?",
@ -1296,19 +1403,7 @@
"current": "Current",
"original": "Original"
}
},
"check_cid": "Match caller number",
"check_cid_tip": "Branch in a callflow based on the A number",
"check_cid_match": "Match",
"check_cid_nomatch": "No match",
"check_cid_matchnomatch": "Match or no match?",
"regex": "Regex",
"webhook": "Send webhook",
"webhook_tip": "Send a webhook to an external webservice when this callflow node is hit",
"webhook_title": "Send a HTTP webhook",
"webhook_uri": "URI",
"webhook_method": "HTTP method",
"webhook_retry": "# retries"
}
},
"__comment": "UI-1260: created common control for carrier selection",
"__version": "v3.20_s2",
@ -1324,5 +1419,9 @@
"title": "Show All Callflows",
"help": "As an admin, you're allowed to see all the existing callflows in this page. This include \"Applications\" Callflows that are created by other apps, but that you don't necesserarily want to update. If you wish to reduce clutter, you can switch this off to hide these callflows."
}
},
"node": {
"disabled": "Node disabled",
"confirmEnable": "This node is disabled. Do you want to enable it?"
}
}

+ 6
- 3
src/apps/callflows/metadata/app.json View File

@ -3,8 +3,8 @@
"i18n": {
"en-US": {
"label": "Callflows",
"description": "The Callflow Manager allows you manage Callflows as well as various VOIP entities.",
"extended_description": "Advanced Callflows features a drag and drop interface which allows users to select from over 50 items in our “call handling toolbox” to chain together. These chains, known as callflows, allow you to manipulate the flow a call takes as a caller traverses various features, menus and call routing decisions in the system. Use the Advanced Callflow editor to configure every step a caller can take when calling a phone number or extension. Route calls to menus, ring groups, voicemails, conference bridges, call queues, call recordings and more.",
"description": "The Callflows allows you manage Callflows as well as various VOIP entities.",
"extended_description": "The Callflows app features a drag and drop interface which allows users to select from over 50 items in our “call handling toolbox” to chain together. These chains, known as callflows, allow you to manipulate the flow a call takes as a caller traverses various features, menus and call routing decisions in the system. Use the Callflows app editor to configure every step a caller can take when calling a phone number or extension. Route calls to menus, ring groups, voicemails, conference bridges, call queues, call recordings and more.",
"features": [
"Drag and drop management",
"50+ call handling actions such as: Time of Day Routing, Device/User Routing, Menus/IVRs, Call Pickup, BLF/Presence Manipulation, Outbound Call Routing...",
@ -13,7 +13,9 @@
]
}
},
"tags": [],
"tags": [
"admin"
],
"icon": "Callflows_app.png",
"api_url": "http://10.26.0.41:8000/v2",
"author": "2600Hz",
@ -29,5 +31,6 @@
"documentation": "{documentation_url}",
"howto": "{howto_video_url}"
},
"phase": "gold",
"pvt_type": "app"
}

+ 255
- 93
src/apps/callflows/style/app.css View File

@ -16,22 +16,27 @@
float: left;
width: 85%;
}
#ws_callflow .callflow .root {
#ws_callflow .callflow .root,
.callflow-preview .callflow .root {
width: 322px;
}
#ws_callflow .callflow .root > .top_bar {
#ws_callflow .callflow .root > .top_bar,
.callflow-preview .callflow .root > .top_bar {
background: #0081D6;
height: 25px;
text-align: left;
border-radius: 6px 6px 0 0;
}
#ws_callflow .callflow .root > .top_bar > span {
#ws_callflow .callflow .root > .top_bar > span,
.callflow-preview .callflow .root > .top_bar > span {
line-height: 25px;
}
#ws_callflow .callflow .root > .top_bar .name {
#ws_callflow .callflow .root > .top_bar .name,
.callflow-preview .callflow .root > .top_bar .name {
float: left;
margin-left: 10px;
font-weight: normal;
@ -39,22 +44,31 @@
cursor: default;
}
#ws_callflow .callflow .root > .top_bar .add_number {
#ws_callflow .callflow .root > .top_bar .add_number,
.callflow-preview .callflow .root > .top_bar .add_number {
float: right;
}
#ws_callflow .callflow .root > .content .number_row {
#ws_callflow .callflow .root > .content .number_row,
.callflow-preview .callflow .root > .content .number_row {
height: 30px;
background: #0081D6;
border-top: 1px solid white;
border-top: 1px solid white
}
#ws_callflow .callflow .root > .content .number_row:last-child {
background: none;
background-color: #0081D6;
height: 30px;
border-radius: 0px 0px 2px 2px;
}
#ws_callflow .callflow .root > .content .number_column {
.callflow-preview .callflow .root > .content .number_row:last-child:not(:first-child) {
display: none !important;
}
#ws_callflow .callflow .root > .content .number_column,
.callflow-preview .callflow .root > .content .number_column {
float: left;
height: 30px;
line-height: 30px;
@ -65,31 +79,37 @@
color: white;
}
#ws_callflow .callflow .root > .content .number_column.full {
#ws_callflow .callflow .root > .content .number_column.full,
.callflow-preview .callflow .root > .content .number_column.full {
width: 100%;
text-align: center;
}
#ws_callflow .callflow .root > .content .number_column.second {
#ws_callflow .callflow .root > .content .number_column.second,
.callflow-preview .callflow .root > .content .number_column.second {
width: 162px;
border-left: 1px solid white;
}
#ws_callflow .callflow .root > .content .number_column.first {
#ws_callflow .callflow .root > .content .number_column.first,
.callflow-preview .callflow .root > .content .number_column.first {
width: 159px;
}
#ws_callflow .callflow .root > .content .number_column.empty {
#ws_callflow .callflow .root > .content .number_column.empty,
.callflow-preview .callflow .root > .content .number_column.empty {
color: white;
cursor: default;
}
#ws_callflow .callflow .root > .content .number_column.add-number {
cursor: pointer;
#ws_callflow .callflow .root > .content .number_column.add-number,
.callflow-preview .callflow .root > .content .number_column.add-number {
cursor: pointer;
background: #22A5FF;
}
#ws_callflow .callflow .root > .content .number_column .delete {
#ws_callflow .callflow .root > .content .number_column .delete,
.callflow-preview .callflow .root > .content .number_column .delete {
background-image: url(static/images/btn_delete.png);
background-repeat: no-repeat;
background-position: center;
@ -103,18 +123,37 @@
cursor: pointer;
}
#ws_callflow .callflow .node {
#ws_callflow .callflow .root > .content .number_column .delete:hover,
.callflow-preview .callflow .root > .content .number_column .delete:hover {
background-image: url(static/images/btn_delete_blue.png);
}
.callflow-preview span.delete,
.callflow-preview .number_column.empty,
.callflow-preview span.edit_icon {
display: none !important;
}
#ws_callflow .callflow .node,
.callflow-preview .callflow .node {
display: inline-block;
cursor: -moz-grab;
cursor: -webkit-grab;
cursor: grab;
}
#ws_callflow .callflow .node[name="root"] {
#ws_callflow .callflow .node.disabled,
.callflow-preview .callflow .node.disabled {
opacity: 0.6;
}
#ws_callflow .callflow .node[name="root"],
.callflow-preview .callflow .node[name="root"] {
cursor: default;
}
#ws_callflow .callflow .node .node-options .delete {
#ws_callflow .callflow .node .node-options .delete,
.callflow-preview .callflow .node .node-options .delete {
background-image: url(static/images/btn_delete.png);
background-repeat: no-repeat;
background-position: center;
@ -128,12 +167,20 @@
color: #555;
}
#ws_callflow .tool .fa {
#ws_callflow .callflow .node .node-options .delete:hover,
.callflow-preview .callflow .node .node-options .delete:hover {
background-image: url(static/images/btn_delete_blue.png);
}
#ws_callflow .tool .fa,
.callflow-preview .tool .fa {
margin: 2px 2px 5px;
color: white;
display: inline-block;
}
#ws_callflow .tools .category {
#ws_callflow .tools .category,
.callflow-preview .tools .category {
text-align: center;
background: #0081D6;
background-position: top center;
@ -141,13 +188,15 @@
border-bottom: 1px solid white;
}
#ws_callflow .tools .category .content {
#ws_callflow .tools .category .content,
.callflow-preview .tools .category .content {
background-color: white;
border: 1px solid #0081D6;
padding: 1px 0px 3px;
}
#ws_callflow .tools .open {
#ws_callflow .tools .open,
.callflow-preview .tools .open {
font-size: 12px;
height: 26px;
line-height: 26px;
@ -155,12 +204,14 @@
background-position: 5px center;
}
#ws_callflow .tools .active .open {
#ws_callflow .tools .active .open,
.callflow-preview .tools .active .open {
color: white;
position: relative;
}
#ws_callflow .tools .active .open::before {
#ws_callflow .tools .active .open::before,
.callflow-preview .tools .active .open::before {
content: '\f078';
font: normal normal normal 14px/1 FontAwesome;
display: inline-block;
@ -173,17 +224,20 @@
color: white;
}
#ws_callflow .tools .inactive .open {
#ws_callflow .tools .inactive .open,
.callflow-preview .tools .inactive .open {
color: white;
position: relative;
cursor: pointer;
}
#ws_callflow .tools .inactive .open:hover {
#ws_callflow .tools .inactive .open:hover,
.callflow-preview .tools .inactive .open:hover {
background: #22A5FF;
}
#ws_callflow .tools .inactive .open::before {
#ws_callflow .tools .inactive .open::before,
.callflow-preview .tools .inactive .open::before {
content: '\f054';
font: normal normal normal 14px/1 FontAwesome;
display: inline-block;
@ -196,7 +250,8 @@
color: white;
}
#ws_callflow .tools .tool {
#ws_callflow .tools .tool,
.callflow-preview .tools .tool {
background: white;
float: left;
width: 78px;
@ -208,12 +263,14 @@
margin: 1px 1px 1px 2px;
}
#ws_callflow .destination {
#ws_callflow .destination,
.callflow-preview .destination {
border-radius: 2px;
border: 3px solid #22A5FF;
}
#ws_callflow .tools .tool .action {
#ws_callflow .tools .tool .action,
.callflow-preview .tools .tool .action {
z-index: 19;
height: 53px;
border-radius: 6px;
@ -224,31 +281,38 @@
width: 76px;
}
#ws_callflow .tools .tool .action:hover {
#ws_callflow .tools .tool .action:hover,
.callflow-preview .tools .tool .action:hover {
background: #22A5FF;
border: 1px solid #22A5FF;
}
#ws_callflow .tools .app_list_nav {
#ws_callflow .tools .app_list_nav,
.callflow-preview .tools .app_list_nav {
background: white;
}
#ws_callflow .callflow .icons_black.node {
#ws_callflow .callflow .icons_black.node,
.callflow-preview .callflow .icons_black.node {
width: 132px;
height: 84px;
background: #0081D6;
border-radius: 6px;
}
#ws_callflow #ws_cf_flow .children .child:last-child:not(:first-child) {
.callflow-preview .children .child:last-child:not(:first-child),
#ws_cf_flow .children .child:last-child:not(:first-child) {
padding-right: 10px;
}
.callflow-preview .children .child:first-child:not(:last-child),
#ws_callflow #ws_cf_flow .children .child:first-child:not(:last-child) {
padding-left: 10px;
}
#ws_callflow .children > .child > .div_line {
#ws_callflow .children > .child > .div_line,
.callflow-preview .children > .child > .div_line {
display: inline-block;
height: 6px;
width: 100%;
@ -260,20 +324,24 @@
padding: 0px;
float: left;
}
#ws_callflow .children > .child:first-child > .div_line {
#ws_callflow #ws_cf_flow .children > .child:first-child > .div_line,
.callflow-preview .children > .child:first-child > .div_line {
width: 50%;
float: right;
}
.callflow-preview .children > .child:last-child > .div_line,
#ws_callflow .children > .child:last-child > .div_line {
width: 50%;
float: left;
}
#ws_callflow .children > .child:first-child:last-child > .div_line {
#ws_callflow .children > .child:first-child:last-child > .div_line,
.callflow-preview .children > .child:first-child:last-child > .div_line {
display: none;
}
#ws_callflow .children > .child > .span_arrow {
#ws_callflow .children > .child > .span_arrow,
.callflow-preview .children > .child > .span_arrow {
display: inline-block;
width: 145px;
background-repeat: no-repeat;
@ -283,43 +351,51 @@
position: relative;
}
#ws_callflow .children > .child > .span_arrow.small {
#ws_callflow .children > .child > .span_arrow.small,
.callflow-preview .children > .child > .span_arrow.small {
height: 31px;
background-image: url(static/images/center_arrow.png);
}
#ws_callflow .children > .child:first-child > .span_arrow.small {
#ws_callflow .children > .child:first-child > .span_arrow.small,
.callflow-preview .children > .child:first-child > .span_arrow.small {
background-image: url(static/images/left_arrow.png);
}
#ws_callflow .children > .child:last-child > .span_arrow.small {
#ws_callflow .children > .child:last-child > .span_arrow.small,
.callflow-preview .children > .child:last-child > .span_arrow.small {
background-image: url(static/images/right_arrow.png);
}
#ws_callflow .children > .child:first-child:last-child > .span_arrow.small {
#ws_callflow .children > .child:first-child:last-child > .span_arrow.small,
.callflow-preview .children > .child:first-child:last-child > .span_arrow.small {
background-image: url(static/images/small_arrow.png);
}
#ws_callflow .children > .child > .span_arrow.large {
#ws_callflow .children > .child > .span_arrow.large,
.callflow-preview .children > .child > .span_arrow.large {
float: none;
height: 48px;
background-image: url(static/images/tall_arrow.png);
}
#ws_callflow .children > .child > .fa {
#ws_callflow .children > .child > .fa,
.callflow-preview .children > .child > .fa {
font-size: 48px;
color: #303039;
margin: 9px 0 7px;
}
#ws_callflow .a_link_option {
#ws_callflow .a_link_option,
.callflow-preview .a_link_option {
color: white;
font-size: 17px;
display: block;
padding: 2px 0;
}
#ws_callflow .div_option {
#ws_callflow .div_option,
.callflow-preview .div_option {
display: inline-block;
line-height: 1;
width: 131px;
@ -330,26 +406,30 @@
border-radius: 2px;
}
#ws_callflow .div_icon {
#ws_callflow .div_icon,
.callflow-preview .div_icon {
height: 46px;
padding: 0 10px;
}
#ws_callflow .div_icon > .fa {
#ws_callflow .div_icon > .fa,
.callflow-preview .div_icon > .fa {
font-size: 23px;
margin-right: 7px;
color: white;
vertical-align: top;
}
#ws_callflow .module {
#ws_callflow .module,
.callflow-preview .module {
font-size: 13px;
height: 49px;
margin-top: 15px;
cursor: default;
}
#ws_callflow .div_icon .module_name {
#ws_callflow .div_icon .module_name,
.callflow-preview .div_icon .module_name {
text-transform: uppercase;
text-align: center;
vertical-align: top;
@ -360,12 +440,26 @@
color: white;
}
#ws_callflow .details {
#ws_callflow .details,
.callflow-preview .details {
font-size: 10px;
overflow: hidden;
color: white;
}
.dialog_popup.callflow-preview {
padding-left: 0px;
padding-right: 0px;
}
.callflow-preview .details a {
color: #22A5FF;
}
.callflow-preview * {
cursor: default !important; /* Only a preview, cannot click */
}
/* Add number and Edit name popups */
.dialog_popup_new {
padding: 15px;
@ -455,7 +549,8 @@
cursor: grabbing !important;
}
#ws_callflow .root .top_bar .edit_icon {
#ws_callflow .root .top_bar .edit_icon,
.callflow-preview .root .top_bar .edit_icon {
cursor: pointer;
display: inline-block;
margin: 3px 0 0 7px;
@ -464,7 +559,8 @@
color: white;
}
#ws_callflow .root .top_bar .edit_icon i {
#ws_callflow .root .top_bar .edit_icon i,
.callflow-preview .root .top_bar .edit_icon i {
color: white;
}
@ -496,11 +592,24 @@
font-size: 23px;
}
#callflow_container .callflow-help, .popup_help .callflow-help {
background: url(static/images/callflow_help.gif) no-repeat center;
height: 644px;
width: 847px;
margin: 20px auto auto;
border-radius: 10px;
}
#callflow_container .callflow-content.edition-mode .callflow-help {
display: none;
}
#callflow_container .callflow-content.listing-mode #ws_callflow {
display: none;
}
#ws_callflow {
#ws_callflow,
.callflow-preview {
width: 100%;
}
@ -514,88 +623,112 @@
width: 50%;
}
#ws_callflow #callflow_header {
#ws_callflow #callflow_header,
.callflow-preview #callflow_header {
height: 30px;
margin-top: 15px;
width: 100%;
}
#ws_callflow #callflow_header #pending_change {
#ws_callflow #callflow_header #pending_change,
.callflow-preview #callflow_header #pending_change {
text-align: center;
display: none;
}
#ws_callflow #callflow_header #pending_change span {
#ws_callflow #callflow_header #pending_change span,
.callflow-preview #callflow_header #pending_change span {
color: #22A5FF;
font-weight: lighter;
font-style: italic;
}
#ws_callflow #ws_cf_flow {
#ws_callflow #ws_cf_flow,
.callflow-preview #ws_cf_flow {
width: 100%;
overflow-x: auto;
padding-top: 10px;
text-align: center;
}
#ws_callflow span.flow {
#ws_callflow .callflow-preview,
.callflow-preview .callflow-preview {
width: 100%;
overflow-x: auto;
padding-top: 10px;
text-align: center;
}
#ws_callflow span.flow,
.callflow-preview span.flow {
width: 80%;
}
#ws_callflow .child {
#ws_callflow .child,
.callflow-preview .child {
display: inline-block;
vertical-align: top;
text-align: center;
white-space: normal;
}
#ws_callflow .branch {
#ws_callflow .branch,
.callflow-preview .branch {
display: block;
text-align: center;
}
#ws_callflow .node.active {
#ws_callflow .node.active,
.callflow-preview .node.active {
background-color: #fff;
border-radius: 2px;
border: 3px solid #22A5FF;
}
#ws_callflow .node.inactive {
#ws_callflow .node.inactive,
.callflow-preview .node.inactive {
filter:alpha(opacity=50);
-moz-opacity:0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
}
#ws_callflow .children {
#ws_callflow .children,
.callflow-preview .children {
display: block;
white-space: pre;
}
#ws_callflow .flowchart {
#ws_callflow .flowchart,
.callflow-preview .flowchart {
margin-right: 180px;
overflow: auto;
}
#ws_callflow .tools {
#ws_callflow .tools,
.callflow-preview .tools {
float: right;
overflow-y: auto;
overflow-x: hidden;
}
#ws_callflow .tools #ws_cf_tools {
#ws_callflow .tools #ws_cf_tools,
.callflow-preview .tools #ws_cf_tools {
padding-right: 10px;
padding-top: 10px;
padding-bottom:30px;
width: 168px;
}
#ws_callflow .tools .search-box {
#ws_callflow .tools .search-box,
.callflow-preview .tools .search-box {
border-left: 1px solid #0081D6;
border-right: 1px solid #0081D6;
position: relative;
}
#ws_callflow .tools .search-box input {
#ws_callflow .tools .search-box input,
.callflow-preview .tools .search-box input {
width: 120px;
height: 15px;
margin-top: 3px;
@ -605,29 +738,35 @@
box-shadow: none;
}
#ws_callflow .tool {
#ws_callflow .tool,
.callflow-preview .tool {
text-align: center;
vertical-align: middle;
}
#ws_callflow .tool_name {
#ws_callflow .tool_name,
.callflow-preview .tool_name {
font-size: 11px;
line-height: 11px;
}
#ws_callflow .tools .category.inactive .content {
#ws_callflow .tools .category.inactive .content,
.callflow-preview .tools .category.inactive .content {
display: none;
}
#ws_callflow .tool .action.inactive {
#ws_callflow .tool .action.inactive,
.callflow-preview .tool .action.inactive {
display: none;
}
#ws_callflow .tool .action.active {
#ws_callflow .tool .action.active,
.callflow-preview .tool .action.active {
z-index: 10000;
}
#ws_callflow .title {
#ws_callflow .title,
.callflow-preview .title {
background: #0081D6;
font-size: 15px;
height: 25px;
@ -638,7 +777,8 @@
font-weight: normal;
}
#callflow_container .wrapper_callflow_buttons {
#callflow_container .wrapper_callflow_buttons,
.callflow-preview .wrapper_callflow_buttons {
display: block;
width: 100%;
text-align: center;
@ -646,18 +786,21 @@
margin-bottom: 5px;
}
#callflow_container .wrapper_callflow_buttons .monster-button {
#callflow_container .wrapper_callflow_buttons .monster-button,
.callflow-preview .wrapper_callflow_buttons .monster-button {
width: 114px;
text-align: center;
display: inline-block;
margin-left: 0;
}
#callflow_container .wrapper_callflow_buttons .monster-button:first-child {
#callflow_container .wrapper_callflow_buttons .monster-button:first-child,
.callflow-preview .wrapper_callflow_buttons .monster-button:first-child {
margin-right: 10px;
}
#callflow_container .callflow_helpbox_wrapper {
#callflow_container .callflow_helpbox_wrapper,
.callflow-preview .callflow_helpbox_wrapper {
position: absolute;
right: 185px;
width: 160px;
@ -666,7 +809,8 @@
z-index: 100;
}
#callflow_container .callflow_helpbox_wrapper .tip_box {
#callflow_container .callflow_helpbox_wrapper .tip_box,
.callflow_preview .callflow_helpbox_wrapper .tip_box {
background-color: #3D3D3D;
border: 1px solid #333333;
border-radius: 2px;
@ -678,13 +822,15 @@
color: white;
}
#callflow_container .tooltip {
#callflow_container .tooltip,
.callflow_preview .tooltip {
float: right;
margin-top: 6px;
cursor: pointer;
}
#callflow_container .pulse-box {
#callflow_container .pulse-box,
.callflow-preview .pulse-box {
-webkit-animation: "pulse-box" 1s ease-in-out 0 infinite alternate;
animation-name: pulse-box;
@ -706,7 +852,8 @@
}
/* JR's customization */
#callflow_container {
#callflow_container,
.callflow-preview .callflow {
min-height: 100%;
}
@ -718,6 +865,11 @@
overflow-y: auto;
}
.callflow-preview.callflow {
background-color: #fff;
overflow-y: auto;
}
#callflow_container .left-bar-container {
float: left;
background-color: #F3F3F3;
@ -870,6 +1022,10 @@
white-space: nowrap;
}
.callflow-preview #callflow_jump {
margin-bottom: 10px;
}
/* Popups.css */
.dialog_popup {
padding: 10px 20px;
@ -980,7 +1136,7 @@
.callflows-port .reset_border {
border:0;
background-color:none;
background-color: transparent;
}
.callflows-port .gradient_strong {
@ -1116,6 +1272,9 @@
margin-left:20px;
display:inline;
}
.callflows-port .pill-content .edit_create a {
color: #EEE;
}
.callflows-port .pill-content .edit_create > a:not(:first-child) {
margin-left: 15px;
@ -1147,9 +1306,6 @@
border-color: #22A5FF;
color: white;
background: #22A5FF;
/*box-shadow:inset 0 0 10px 1px #000;
-moz-box-shadow:inset 0 0 10px 1px #000;
-webkit-box-shadow:inset 0 0 10px 1px #000;*/
}
.callflows-port .btn.black:hover {
@ -1317,7 +1473,7 @@
.callflows-port .tabs {
list-style: none;
padding: 0;
background-color:none;
background-color: transparent;
}
.callflows-port .tabs > li {
@ -1352,6 +1508,14 @@
text-decoration: none;
}
.callflows-port .tabs > li:first-child.active {
border-left:1px solid #22A5FF;
}
.callflows-port .tabs > li:last-child.active {
border-right:0;
}
.callflows-port .tabs > li > a > .fa {
margin-right: 5px;
}
@ -1441,7 +1605,7 @@
text-align: center;
width: 120px;
height: 120px;
padding: 0px;
padding: 0;
font-size: 20px;
cursor: pointer;
border: solid 1px #303039;
@ -1484,8 +1648,7 @@
width: 800px; /* Arbitrary width if calc not supported */
width: -webkit-calc(100% - 241px);
width: -moz-calc(100% - 241px);
width: -o-calc(100% - 241px);
width: calc(100%-241px);
width: calc(100% - 241px);
}
@ -1702,7 +1865,6 @@
text-align: right;
}
.callflows-port .callflow-panel {
background: #22A5FF;
display: inline-block;
@ -1758,4 +1920,4 @@
.tour-backdrop {
opacity: 0.6;
}
}

BIN
src/apps/callflows/style/static/images/callflow_help.gif View File

Before After
Width: 847  |  Height: 644  |  Size: 70 KiB

+ 1
- 1
src/apps/callflows/submodules/blacklist/blacklist.css View File

@ -90,4 +90,4 @@
color: #22A5FF;
margin-right: 10px;
margin-top :15px;
}
}

+ 47
- 20
src/apps/callflows/submodules/blacklist/blacklist.js View File

@ -1,4 +1,4 @@
define(function(require){
define(function(require) {
var $ = require('jquery'),
_ = require('lodash'),
monster = require('monster');
@ -8,7 +8,7 @@ define(function(require){
subscribe: {
'callflows.blacklist.edit': 'blacklistEdit',
'callflows.fetchActions': 'blacklistDefineActions',
'callflows.fetchActions': 'blacklistDefineActions'
},
blacklistDefineActions: function(args) {
@ -24,7 +24,9 @@ define(function(require){
resource: 'blacklist.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: {
paginate: false
}
},
success: function(data, status) {
callback && callback(data.data);
@ -40,18 +42,30 @@ define(function(require){
blacklistEdit: function(args) {
var self = this,
afterGetData = function(data) {
var template = $(monster.template(self, 'blacklist-edit', {data: data})),
var template = $(self.getTemplate({
name: 'edit',
data: {
data: data
},
submodule: 'blacklist'
})),
blacklistForm = template.find('#blacklist-form'),
$listNumbers = template.find('.saved-numbers');
monster.ui.validate(blacklistForm, {
rules: {
'name': { required: true },
'name': { required: true }
}
});
_.each(data.numbers, function(v, number) {
$listNumbers.append(monster.template(self, 'blacklist-addNumber', {number: number}));
$listNumbers.append($(self.getTemplate({
name: 'addNumber',
data: {
number: number
},
submodule: 'blacklist'
})));
});
self.blacklistBindEvents(data, template, args.callbacks);
@ -61,12 +75,11 @@ define(function(require){
.append(template);
};
if(args.data.id) {
if (args.data.id) {
self.blacklistGet(args.data.id, function(data) {
afterGetData(data);
});
}
else {
} else {
afterGetData({});
}
},
@ -77,7 +90,14 @@ define(function(require){
var number = template.find('#number_value').val();
if (number) {
$('.list-numbers .saved-numbers', template).prepend(monster.template(self, 'blacklist-addNumber', { number: number }));
$('.list-numbers .saved-numbers', template)
.prepend($(self.getTemplate({
name: 'addNumber',
data: {
number: number
},
submodule: 'blacklist'
})));
$('#number_value', template).val('');
}
@ -141,14 +161,20 @@ define(function(require){
});
},*/
blacklistBindEvents: function(data, template, callbacks) {
var self = this,
addNumber = function(e) {
var number = template.find('#number_value').val();
if(number) {
$('.list-numbers .saved-numbers', template).prepend(monster.template(self,'blacklist-addNumber', { number: number }));
if (number) {
$('.list-numbers .saved-numbers', template)
.prepend($(self.getTemplate({
name: 'addNumber',
data: {
number: number
},
submodule: 'blacklist'
})));
$('#number_value', template).val('');
}
@ -170,7 +196,7 @@ define(function(require){
$('.add-number', template).bind('keypress', function(e) {
var code = e.keyCode || e.which;
if(code === 13) {;
if (code === 13) {
addNumber(e);
}
});
@ -187,7 +213,7 @@ define(function(require){
});
$('.blacklist-save', template).click(function() {
var formData = form2object('blacklist-form'),
var formData = monster.ui.getFormData('blacklist-form'),
cleanData = self.blacklistCleanFormData(formData),
mapNumbers = {};
@ -198,7 +224,7 @@ define(function(require){
cleanData.numbers = mapNumbers;
if(data.id) {
if (data.id) {
cleanData.id = data.id;
}
@ -221,10 +247,9 @@ define(function(require){
blacklistSave: function(data, callback) {
var self = this;
if(data.id) {
if (data.id) {
self.blacklistUpdate(data, callback);
}
else {
} else {
self.blacklistCreate(data, callback);
}
},
@ -236,7 +261,9 @@ define(function(require){
resource: 'blacklist.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: {
paginate: false
}
},
success: function(data) {
callback && callback(data.data);


src/apps/callflows/views/blacklist-addNumber.html → src/apps/callflows/submodules/blacklist/views/addNumber.html View File


src/apps/callflows/views/blacklist-edit.html → src/apps/callflows/submodules/blacklist/views/edit.html View File


+ 98
- 68
src/apps/callflows/submodules/callcenter/callcenter.js View File

@ -1,9 +1,8 @@
define(function(require){
define(function(require) {
var $ = require('jquery'),
_ = require('lodash'),
toastr = require('toastr'),
monster = require('monster'),
timezone = require('monster-timezone');
monster = require('monster');
var app = {
requests: {
@ -87,7 +86,7 @@ define(function(require){
callcenterDefineActions: function(args) {
var self = this,
callflow_nodes= args.actions,
callflow_nodes = args.actions,
i18nApp = self.i18n.active().callflows.callcenter;
$.extend(callflow_nodes, {
@ -112,7 +111,7 @@ define(function(require){
var id = node.getMetadata('id'),
returned_value = '';
if(id in caption_map) {
if (id in caption_map) {
returned_value = caption_map[id].name;
}
@ -122,21 +121,24 @@ define(function(require){
self.getQueuesList(function(queues) {
var popup, popup_html;
popup_html = $(monster.template(self, 'callcenter-queue-callflow' , {
i18n: self.i18n.active(),
objects: {
items: queues,
selected: node.getMetadata('id') || ''
}
popup_html = $(self.getTemplate({
name: 'queue-callflow',
data: {
i18n: self.i18n.active(),
objects: {
items: queues,
selected: node.getMetadata('id') || ''
}
},
submodule: 'callcenter'
}));
if($('#queue_selector option:selected', popup_html).val() == undefined) {
if ($('#queue_selector option:selected', popup_html).val() === undefined) {
$('#edit_link', popup_html).hide();
}
$('.inline_action', popup_html).click(function(ev) {
var _data = ($(this).data('action') == 'edit') ?
{ id: $('#queue_selector', popup_html).val() } : {};
var _data = ($(this).data('action') === 'edit') ? { id: $('#queue_selector', popup_html).val() } : {};
ev.preventDefault();
@ -155,14 +157,13 @@ define(function(require){
node.setMetadata('id', $('#queue_selector', popup).val());
node.caption = $('#queue_selector option:selected', popup).text();
popup.dialog('close');
});
popup = monster.ui.dialog(popup_html, {
title: self.i18n.active().callflows.callcenter.selectQueue,
minHeight: '0',
beforeClose: function() {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -203,7 +204,7 @@ define(function(require){
return '';
},
edit: function(node, callback) {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -229,7 +230,7 @@ define(function(require){
return '';
},
edit: function(node, callback) {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -255,7 +256,7 @@ define(function(require){
return '';
},
edit: function(node, callback) {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -281,7 +282,7 @@ define(function(require){
return '';
},
edit: function(node, callback) {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -307,7 +308,7 @@ define(function(require){
return '';
},
edit: function(node, callback) {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -336,14 +337,14 @@ define(function(require){
save_success: function(_data) {
popup.dialog('close');
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback(_data);
}
},
delete_success: function() {
popup.dialog('close');
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback({ data: {} });
}
},
@ -406,24 +407,24 @@ define(function(require){
self.getUsersList(function(users) {
defaults.field_data.users = users;
if(typeof data == 'object' && data.id) {
self.queueGet(data.id, function (queueData) {
if (typeof data === 'object' && data.id) {
self.queueGet(data.id, function(queueData) {
var render_data = $.extend(true, defaults, queueData);
render_data.field_data.old_list = [];
if('agents' in queueData.data) {
if ('agents' in queueData.data) {
render_data.field_data.old_list = queueData.data.agents;
}
self.queueRender(render_data, target, callbacks);
if(typeof(callbacks.after_render) === 'function') {
if (typeof (callbacks.after_render) === 'function') {
callbacks.after_render();
}
});
} else {
self.queueRender(defaults, target, callbacks);
if(typeof(callbacks.after_render) === 'function') {
if (typeof (callbacks.after_render) === 'function') {
callbacks.after_render();
}
}
@ -447,7 +448,7 @@ define(function(require){
});
},
queueRenderList: function(_parent, callback){
queueRenderList: function(_parent, callback) {
var self = this,
parent = _parent || $('#queue-content'),
i18nApp = self.i18n.active().callflows.callcenter;
@ -456,7 +457,7 @@ define(function(require){
var map_crossbar_data = function(data) {
var new_list = [];
if(data.length > 0) {
if (data.length > 0) {
$.each(data, function(key, val) {
new_list.push({
id: val.id,
@ -484,7 +485,7 @@ define(function(require){
accountId: self.accountId,
generateError: false
},
success: function (data) {
success: function(data) {
callback && callback(data.data);
}
});
@ -499,19 +500,22 @@ define(function(require){
queuesId: queueId,
generateError: false
},
success: function (_data) {
if(typeof(callback) === 'function') {
success: function(_data) {
if (typeof (callback) === 'function') {
callback(_data);
}
}
});
},
queueRender: function(data, target, callbacks) {
var self = this;
data.i18nApp = self.i18n.active().callflows.callcenter;
var queue_html = $(monster.template(self, 'callcenter-queue-edit' , data));
var queue_html = $(self.getTemplate({
name: 'queue-edit',
data: data,
submodule: 'callcenter'
}));
self.userListRender(data, queue_html);
@ -528,7 +532,7 @@ define(function(require){
$('.queue-save', queue_html).click(function(ev) {
ev.preventDefault();
if(monster.ui.valid($form)) {
if (monster.ui.valid($form)) {
var form_data = monster.ui.getFormData($form[0]);
var agentsList = [];
@ -543,7 +547,6 @@ define(function(require){
};
self.queueSave(form_data, data, callbacks.save_success, callbacks.save_error);
} else {
toastr.error(self.i18n.active().callflows.callcenter.formHasErrorsMessage);
}
@ -552,7 +555,6 @@ define(function(require){
$('.queue-delete', queue_html).click(function(ev) {
ev.preventDefault();
monster.ui.confirm(self.i18n.active().callflows.callcenter.deleteConfirmMessage, function() {
self.queueDelete(data, callbacks.delete_success, callbacks.delete_error);
});
@ -563,19 +565,25 @@ define(function(require){
var $userSelect = $('#users-list', queue_html);
if($userSelect.val() != 'empty_option_user') {
if ($userSelect.val() !== 'empty_option_user') {
var user_id = $userSelect.val(),
user_data = {
user_id: user_id,
user_name: $('#option_user_' + user_id, queue_html).text()
};
if($('#row_no_data', queue_html).size() > 0) {
if ($('#row_no_data', queue_html).size() > 0) {
$('#row_no_data', queue_html).remove();
}
$('.js-user-table-body', queue_html).prepend($(monster.template(self, 'callcenter-user-row' , user_data)));
$('#option_user_'+user_id, queue_html).hide();
$('.js-user-table-body', queue_html).prepend(
$(self.getTemplate({
name: 'user-row',
data: user_data,
submodule: 'callcenter'
}))
);
$('#option_user_' + user_id, queue_html).hide();
$userSelect.val('empty_option_user');
}
@ -602,11 +610,17 @@ define(function(require){
$('#row_user_' + user_id, queue_html).remove();
//re-add it to the dropdown
$('#option_user_'+user_id, queue_html).show();
$('#option_user_' + user_id, queue_html).show();
//if grid empty, add no data line
if($('.js-user-table-body .js-user-table-item', queue_html).size() == 0) {
$('.js-user-table-body', queue_html).append($(monster.template(self, 'callcenter-user-row')));
if ($('.js-user-table-body .js-user-table-item', queue_html).size() === 0) {
$('.js-user-table-body', queue_html).append(
$(self.getTemplate({
name: 'user-row',
data: {},
submodule: 'callcenter'
}))
);
}
});
@ -625,7 +639,7 @@ define(function(require){
data: agentsIdList
},
success: function(data) {
if(typeof(callback) === 'function' && data.data) {
if (typeof (callback) === 'function' && data.data) {
callback(data.data);
}
}
@ -635,7 +649,7 @@ define(function(require){
queueDelete: function(data, success, error) {
var self = this;
if(typeof data.data == 'object' && data.data.id) {
if (typeof data.data === 'object' && data.data.id) {
monster.request({
resource: 'callcenter.queues.delete',
data: {
@ -644,12 +658,12 @@ define(function(require){
generateError: false
},
success: function(_data, status) {
if(typeof success == 'function') {
if (typeof success === 'function') {
success(_data, status);
}
},
error: function(_data, status) {
if(typeof error == 'function') {
if (typeof error === 'function') {
error(_data, status);
}
}
@ -660,14 +674,18 @@ define(function(require){
userListRender: function(data, parent) {
var self = this;
if(data.data.id) {
if('agents' in data.data && data.data.agents.length > 0) {
if (data.data.id) {
if ('agents' in data.data && data.data.agents.length > 0) {
var user_item;
$.each(data.field_data.users, function(k, v) {
if(data.data.agents.indexOf(v.id) >= 0) {
var html = $(monster.template(self, 'callcenter-user-row' , {
user_id: v.id,
user_name: v.first_name + ' ' + v.last_name
if (data.data.agents.indexOf(v.id) >= 0) {
var html = $(self.getTemplate({
name: 'user-row',
data: {
user_id: v.id,
user_name: v.first_name + ' ' + v.last_name
},
submodule: 'callcenter'
}));
$('.js-user-table-body', parent).append(html);
@ -676,11 +694,23 @@ define(function(require){
});
} else {
$('.js-user-table-body', parent).empty()
.append($(monster.template(self, 'callcenter-user-row')));
.append(
$(self.getTemplate({
name: 'user-row',
data: {},
submodule: 'callcenter'
}))
);
}
} else {
$('.js-user-table-body', parent).empty()
.append($(monster.template(self, 'callcenter-user-row')));
.append(
$(self.getTemplate({
name: 'user-row',
data: {},
submodule: 'callcenter'
}))
);
}
},
@ -688,21 +718,21 @@ define(function(require){
var self = this,
normalized_data = self.normalizeData($.extend(true, {}, data.data, form_data));
if(typeof data.data == 'object' && data.data.id) {
if (typeof data.data === 'object' && data.data.id) {
var queueId = data.data.id;
self.queueUpdate(queueId, normalized_data, function(queueData) {
self.agentsSave(queueId, data.field_data.user_list.new_list, function(agentsData) {
queueData.agents = agentsData.agents;
if(typeof(success) === 'function') {
if (typeof (success) === 'function') {
success(queueData);
}
});
});
} else {
self.queueCreate(normalized_data, function(queueData){
self.queueCreate(normalized_data, function(queueData) {
self.agentsSave(queueData.id, data.field_data.user_list.new_list, function(agentsData) {
queueData.agents = agentsData.agents;
if(typeof(success) === 'function') {
if (typeof (success) === 'function') {
success(queueData);
}
});
@ -721,20 +751,20 @@ define(function(require){
generateError: false,
data: data
},
success: function (data) {
if(typeof(success) === 'function' && data.data) {
success: function(data) {
if (typeof (success) === 'function' && data.data) {
success(data.data);
}
},
error: function(data) {
if(typeof(error) === 'function') {
if (typeof (error) === 'function') {
error(data);
}
}
});
},
queueCreate: function(data, success, error){
queueCreate: function(data, success, error) {
var self = this;
monster.request({
@ -744,13 +774,13 @@ define(function(require){
generateError: false,
data: data
},
success: function (_data) {
if(typeof(success) === 'function') {
success: function(_data) {
if (typeof (success) === 'function') {
success(_data.data);
}
},
error: function(_data) {
if(typeof(error) === 'function') {
if (typeof (error) === 'function') {
error(_data);
}
}


src/apps/callflows/views/callcenter-queue-callflow.html → src/apps/callflows/submodules/callcenter/views/queue-callflow.html View File


src/apps/callflows/views/callcenter-queue-edit.html → src/apps/callflows/submodules/callcenter/views/queue-edit.html View File


src/apps/callflows/views/callcenter-queue.html → src/apps/callflows/submodules/callcenter/views/queue.html View File


src/apps/callflows/views/callcenter-user-row.html → src/apps/callflows/submodules/callcenter/views/user-row.html View File


+ 133
- 143
src/apps/callflows/submodules/conference/conference.js View File

@ -1,4 +1,4 @@
define(function(require){
define(function(require) {
var $ = require('jquery'),
_ = require('lodash'),
monster = require('monster');
@ -38,7 +38,7 @@ define(function(require){
var id = node.getMetadata('id'),
returned_value = '';
if(id in caption_map) {
if (id in caption_map) {
returned_value = caption_map[id].name;
}
@ -46,18 +46,22 @@ define(function(require){
},
edit: function(node, callback) {
self.conferenceList(function(data, status) {
var popup_html = $(monster.template(self, 'conference-callflowEdit', {
items: _.sortBy(data, 'name'),
selected: node.getMetadata('id') || ''
var popup_html = $(self.getTemplate({
name: 'callflowEdit',
data: {
items: _.sortBy(data, 'name'),
selected: node.getMetadata('id') || ''
},
submodule: 'conference'
})),
popup;
if($('#conference_selector option:selected', popup_html).val() == undefined) {
if ($('#conference_selector option:selected', popup_html).val() === undefined) {
$('#edit_link', popup_html).hide();
}
$('.inline_action', popup_html).click(function(ev) {
var _data = ($(this).data('action') == 'edit') ? { id: $('#conference_selector', popup_html).val() } : {};
var _data = ($(this).data('action') === 'edit') ? { id: $('#conference_selector', popup_html).val() } : {};
ev.preventDefault();
@ -82,7 +86,7 @@ define(function(require){
title: self.i18n.active().callflows.conference.conference,
minHeight: '0',
beforeClose: function() {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -94,7 +98,7 @@ define(function(require){
resource: 'conference.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: { paginate: false }
},
success: function(data, status) {
callback && callback(data.data);
@ -123,7 +127,7 @@ define(function(require){
return '';
},
edit: function(node, callback) {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -140,14 +144,14 @@ define(function(require){
save_success: function(_data) {
popup.dialog('close');
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback(_data);
}
},
delete_success: function() {
popup.dialog('close');
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback({ data: {} });
}
},
@ -180,7 +184,7 @@ define(function(require){
save_error: _callbacks.save_error,
delete_success: _callbacks.delete_success || function() {
target.empty(),
target.empty();
self.conferenceRenderList(parent);
},
@ -201,66 +205,69 @@ define(function(require){
};
monster.parallel({
user_list: function(callback) {
self.callApi({
resource: 'user.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
},
success: function(_data, status) {
_data.data.unshift({
id: '',
first_name: '- No',
last_name: 'owner -'
});
defaults.field_data.users = _data.data;
callback(null, _data);
user_list: function(callback) {
self.callApi({
resource: 'user.list',
data: {
accountId: self.accountId,
filters: {
paginate: false
}
});
},
get_conference: function(callback) {
if(typeof data == 'object' && data.id) {
self.conferenceGet(data.id, function(_data, status) {
self.conferenceMigrateData(_data);
},
success: function(_data, status) {
_data.data.unshift({
id: '',
first_name: '- No',
last_name: 'owner -'
});
self.conferenceFormatData(_data);
defaults.field_data.users = _data.data;
callback(null, _data);
});
callback(null, _data);
}
else {
callback(null, {});
}
}
});
},
function(err, results) {
var render_data = defaults;
get_conference: function(callback) {
if (typeof data === 'object' && data.id) {
self.conferenceGet(data.id, function(_data, status) {
self.conferenceMigrateData(_data);
if(typeof data === 'object' && data.id) {
render_data = $.extend(true, defaults, { data: results.get_conference });
self.conferenceFormatData(_data);
callback(null, _data);
});
} else {
callback(null, {});
}
}
}, function(err, results) {
var render_data = defaults;
self.conferenceRender(render_data, target, callbacks);
if (typeof data === 'object' && data.id) {
render_data = $.extend(true, defaults, { data: results.get_conference });
}
if(typeof callbacks.after_render == 'function') {
callbacks.after_render();
}
self.conferenceRender(render_data, target, callbacks);
if (typeof callbacks.after_render === 'function') {
callbacks.after_render();
}
);
});
},
conferenceRender: function(data, target, callbacks){
conferenceRender: function(data, target, callbacks) {
var self = this,
conference_html = $(monster.template(self, 'conference-edit', data)),
conference_html = $(self.getTemplate({
name: 'edit',
data: data,
submodule: 'conference'
})),
conference_form = conference_html.find('#conference_form');
monster.ui.validate(conference_form, {
rules: {
name: {
required: true,
required: true
},
'member.pins_string': {
regex: /^[a-z0-9A-Z,\s]*$/
@ -285,7 +292,7 @@ define(function(require){
self.winkstartTabs(conference_html);
if(!$('#owner_id', conference_html).val()) {
if (!$('#owner_id', conference_html).val()) {
$('#edit_link', conference_html).hide();
}
@ -294,7 +301,7 @@ define(function(require){
});
$('.inline_action', conference_html).click(function(ev) {
var _data = ($(this).data('action') == 'edit') ? { id: $('#owner_id', conference_html).val() } : {},
var _data = ($(this).data('action') === 'edit') ? { id: $('#owner_id', conference_html).val() } : {},
_id = _data.id;
ev.preventDefault();
@ -303,19 +310,17 @@ define(function(require){
data: _data,
callback: function(_data) {
/* Create */
if(!_id) {
$('#owner_id', conference_html).append('<option id="'+ _data.id +'" value="'+ _data.id +'">'+ _data.first_name + ' ' + _data.last_name +'</option>');
if (!_id) {
$('#owner_id', conference_html).append('<option id="' + _data.id + '" value="' + _data.id + '">' + _data.first_name + ' ' + _data.last_name + '</option>');
$('#owner_id', conference_html).val(_data.id);
$('#edit_link', conference_html).show();
}
else {
} else {
/* Update */
if('id' in _data) {
$('#owner_id #'+_data.id, conference_html).text(_data.first_name + ' ' + _data.last_name);
}
if ('id' in _data) {
$('#owner_id #' + _data.id, conference_html).text(_data.first_name + ' ' + _data.last_name);
/* Delete */
else {
$('#owner_id #'+_id, conference_html).remove();
} else {
$('#owner_id #' + _id, conference_html).remove();
$('#edit_link', conference_html).hide();
}
}
@ -327,7 +332,7 @@ define(function(require){
ev.preventDefault();
var $this = $(this);
if(!$this.hasClass('disabled')) {
if (!$this.hasClass('disabled')) {
$this.addClass('disabled');
if (monster.ui.valid(conference_form)) {
var form_data = monster.ui.getFormData('conference_form');
@ -336,7 +341,7 @@ define(function(require){
data.data.member.pins = form_data.member.pins;
if('field_data' in data) {
if ('field_data' in data) {
delete data.field_data;
}
@ -344,8 +349,7 @@ define(function(require){
$this.removeClass('disabled');
callbacks && callbacks.hasOwnProperty('save_error') && callbacks.save_error(data);
});
}
else {
} else {
$this.removeClass('disabled');
monster.ui.alert(self.i18n.active().callflows.conference.there_were_errors_on_the_form);
};
@ -370,23 +374,23 @@ define(function(require){
self.conferenceList(function(data, status) {
var map_crossbar_data = function(data) {
var new_list = [];
var new_list = [];
if(data.length > 0) {
$.each(data, function(key, val) {
new_list.push({
id: val.id,
title: val.name || self.i18n.active().callflows.conference.name
});
if (data.length > 0) {
$.each(data, function(key, val) {
new_list.push({
id: val.id,
title: val.name || self.i18n.active().callflows.conference.name
});
}
new_list.sort(function(a, b) {
return a.title.toLowerCase() < b.title.toLowerCase() ? -1 : 1;
});
}
return new_list;
};
new_list.sort(function(a, b) {
return a.title.toLowerCase() < b.title.toLowerCase() ? -1 : 1;
});
return new_list;
};
// $('#conference-listpanel', parent)
// .empty()
@ -404,24 +408,24 @@ define(function(require){
},
conferenceMigrateData: function(data) {
if(data.member_play_name) {
if(data.play_name_on_join == undefined) {
if (data.member_play_name) {
if (data.play_name_on_join === undefined) {
data.play_name_on_join = data.member_play_name;
}
delete data.member_play_name;
}
if(data.member_join_muted) {
if(data.member.join_muted == undefined) {
if (data.member_join_muted) {
if (data.member.join_muted === undefined) {
data.member.join_muted = data.member_join_muted;
}
delete data.member_join_muted;
}
if(data.member_join_deaf) {
if(data.member.join_deaf == undefined) {
if (data.member_join_deaf) {
if (data.member.join_deaf === undefined) {
data.member.join_deaf = data.member_join_deaf;
}
@ -432,12 +436,12 @@ define(function(require){
},
conferenceFormatData: function(data) {
if(typeof data.member == 'object') {
if($.isArray(data.member.pins)) {
if (typeof data.member === 'object') {
if ($.isArray(data.member.pins)) {
data.member.pins_string = data.member.pins.join(', ');
}
if($.isArray(data.conference_numbers)) {
if ($.isArray(data.conference_numbers)) {
data.conference_numbers_string = data.conference_numbers.join(', ');
}
}
@ -445,17 +449,16 @@ define(function(require){
return data;
},
conferenceCleanFormData: function(form_data){
conferenceCleanFormData: function(form_data) {
var self = this;
form_data.member.pins_string = self.conferenceLettersToNumbers(form_data.member.pins_string);
form_data.member.pins = $.map(form_data.member.pins_string.split(','), function(val) {
var pin = $.trim(val);
if(pin != '') {
if (pin !== '') {
return pin;
}
else {
} else {
return null;
}
});
@ -463,10 +466,9 @@ define(function(require){
form_data.conference_numbers = $.map(form_data.conference_numbers_string.split(','), function(val) {
var number = $.trim(val);
if(number != '') {
if (number !== '') {
return number;
}
else {
} else {
return null;
}
});
@ -478,31 +480,23 @@ define(function(require){
var result = '';
$.each(string.split(''), function(index, value) {
if(value.match(/^[aAbBcC]$/)) {
if (value.match(/^[aAbBcC]$/)) {
result += '2';
}
else if(value.match(/^[dDeEfF]$/)) {
} else if (value.match(/^[dDeEfF]$/)) {
result += '3';
}
else if(value.match(/^[gGhHiI]$/)) {
} else if (value.match(/^[gGhHiI]$/)) {
result += '4';
}
else if(value.match(/^[jJkKlL]$/)) {
} else if (value.match(/^[jJkKlL]$/)) {
result += '5';
}
else if(value.match(/^[mMnNoO]$/)) {
} else if (value.match(/^[mMnNoO]$/)) {
result += '6';
}
else if(value.match(/^[pPqQrRsS]$/)) {
} else if (value.match(/^[pPqQrRsS]$/)) {
result += '7';
}
else if(value.match(/^[tTuUvV]$/)) {
} else if (value.match(/^[tTuUvV]$/)) {
result += '8';
}
else if(value.match(/^[wWxXyYzZ]$/)) {
} else if (value.match(/^[wWxXyYzZ]$/)) {
result += '9';
}
else {
} else {
result += value;
}
});
@ -514,31 +508,26 @@ define(function(require){
var self = this,
normalized_data = self.conferenceFixArrays(self.conferenceNormalizeData($.extend(true, {}, data.data, form_data)), form_data);
if(typeof data.data == 'object' && data.data.id) {
if (typeof data.data === 'object' && data.data.id) {
self.conferenceUpdate(normalized_data, function(_data, status) {
if(typeof success == 'function') {
success(_data, status, 'update');
}
},
function(_data, status) {
if(typeof error == 'function') {
error(_data, status, 'update');
}
if (typeof success === 'function') {
success(_data, status, 'update');
}
);
}
else {
}, function(_data, status) {
if (typeof error === 'function') {
error(_data, status, 'update');
}
});
} else {
self.conferenceCreate(normalized_data, function(_data, status) {
if(typeof success == 'function') {
success(_data, status, 'create');
}
},
function(_data, status) {
if(typeof error == 'function') {
error(_data, status, 'create');
}
if (typeof success === 'function') {
success(_data, status, 'create');
}
}, function(_data, status) {
if (typeof error === 'function') {
error(_data, status, 'create');
}
);
});
}
},
@ -546,7 +535,7 @@ define(function(require){
conferenceFixArrays: function(merged_data, form_data) {
var self = this;
if('conference_numbers' in form_data) {
if ('conference_numbers' in form_data) {
merged_data.conference_numbers = form_data.conference_numbers;
}
@ -554,15 +543,15 @@ define(function(require){
},
conferenceNormalizeData: function(data) {
if(!data.member.pins.length) {
if (!data.member.pins.length) {
delete data.member.pins;
}
if(data.hasOwnProperty('member') && data.member.hasOwnProperty('numbers') && !data.member.numbers.length) {
if (data.hasOwnProperty('member') && data.member.hasOwnProperty('numbers') && !data.member.numbers.length) {
delete data.member.numbers;
}
if(!data.owner_id) {
if (!data.owner_id) {
delete data.owner_id;
}
@ -572,7 +561,6 @@ define(function(require){
return data;
},
conferenceList: function(callback) {
var self = this;
@ -580,7 +568,9 @@ define(function(require){
resource: 'conference.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: {
paginate: false
}
},
success: function(data) {
callback && callback(data.data);


src/apps/callflows/views/conference-callflowEdit.html → src/apps/callflows/submodules/conference/views/callflowEdit.html View File


src/apps/callflows/views/conference-edit.html → src/apps/callflows/submodules/conference/views/edit.html View File


+ 368
- 296
src/apps/callflows/submodules/device/device.js
File diff suppressed because it is too large
View File


src/apps/callflows/views/device-callflowEdit.html → src/apps/callflows/submodules/device/views/callflowEdit.html View File


src/apps/callflows/views/device-ata.html → src/apps/callflows/submodules/device/views/device-ata.html View File


src/apps/callflows/views/device-cellphone.html → src/apps/callflows/submodules/device/views/device-cellphone.html View File


src/apps/callflows/views/device-fax.html → src/apps/callflows/submodules/device/views/device-fax.html View File


src/apps/callflows/views/device-landline.html → src/apps/callflows/submodules/device/views/device-landline.html View File


src/apps/callflows/views/device-mobile.html → src/apps/callflows/submodules/device/views/device-mobile.html View File


src/apps/callflows/views/device-sip_device.html → src/apps/callflows/submodules/device/views/device-sip_device.html View File


src/apps/callflows/views/device-sip_uri.html → src/apps/callflows/submodules/device/views/device-sip_uri.html View File


src/apps/callflows/views/device-smartphone.html → src/apps/callflows/submodules/device/views/device-smartphone.html View File


src/apps/callflows/views/device-softphone.html → src/apps/callflows/submodules/device/views/device-softphone.html View File


src/apps/callflows/views/device-entity-element.html → src/apps/callflows/submodules/device/views/entity-element.html View File


src/apps/callflows/views/device-general_edit.html → src/apps/callflows/submodules/device/views/general_edit.html View File


+ 1
- 1
src/apps/callflows/submodules/directory/directory.css View File

@ -171,4 +171,4 @@
.callflows-port #directory-form #basic .add_user .add_user_div:hover .add_user_icon {
background-position: 0 -24px;
cursor: pointer;
}
}

+ 160
- 135
src/apps/callflows/submodules/directory/directory.js View File

@ -1,4 +1,4 @@
define(function(require){
define(function(require) {
var $ = require('jquery'),
_ = require('lodash'),
monster = require('monster');
@ -11,9 +11,13 @@ define(function(require){
'callflows.directory.edit': '_directoryEdit'
},
directoryRender: function(data, target, callbacks){
directoryRender: function(data, target, callbacks) {
var self = this,
directory_html = $(monster.template(self, 'directory-edit', data)),
directory_html = $(self.getTemplate({
name: 'edit',
data: data,
submodule: 'directory'
})),
directoryForm = directory_html.find('#directory-form');
self.directoryRenderUserList(data, directory_html);
@ -83,31 +87,35 @@ define(function(require){
var $user = $('#select_user_id', directory_html);
var $callflow = $('#callflow_id', directory_html);
if($user.val() != 'empty_option_user' && $callflow.val() != 'empty_option_callflow') {
if ($user.val() !== 'empty_option_user' && $callflow.val() !== 'empty_option_callflow') {
var user_id = $user.val(),
user_data = {
user_id: user_id,
user_name: $('#option_user_'+user_id, directory_html).text(),
user_name: $('#option_user_' + user_id, directory_html).text(),
callflow_id: $callflow.val(),
field_data: {
callflows: data.field_data.callflows
},
_t: function(param){
return window.translate['directory'][param];
_t: function(param) {
return window.translate.directory[param];
}
};
if($('#row_no_data', directory_html).size() > 0) {
if ($('#row_no_data', directory_html).size() > 0) {
$('#row_no_data', directory_html).remove();
}
$('.rows', directory_html).prepend(monster.template(self, 'directory-userRow', user_data));
$('#option_user_'+user_id, directory_html).hide();
$('.rows', directory_html)
.prepend($(self.getTemplate({
name: 'userRow',
data: user_data,
submodule: 'directory'
})));
$('#option_user_' + user_id, directory_html).hide();
$user.val('empty_option_user');
$callflow.val('empty_option_callflow');
}
else {
} else {
monster.ui.alert('warning', self.i18n.active().callflows.directory.noDataSelected);
}
});
@ -115,12 +123,16 @@ define(function(require){
$(directory_html).delegate('.action_user.delete', 'click', function() {
var user_id = $(this).data('id');
//removes it from the grid
$('#row_user_'+user_id, directory_html).remove();
$('#row_user_' + user_id, directory_html).remove();
//re-add it to the dropdown
$('#option_user_'+user_id, directory_html).show();
$('#option_user_' + user_id, directory_html).show();
//if grid empty, add no data line
if($('.rows .row', directory_html).size() == 0) {
$('.rows', directory_html).append(monster.template(self, 'directory-userRow'));
if ($('.rows .row', directory_html).size() === 0) {
$('.rows', directory_html)
.append($(self.getTemplate({
name: 'userRow',
submodule: 'directory'
})));
}
});
@ -132,11 +144,11 @@ define(function(require){
directoryRenderUserList: function(data, parent) {
var self = this;
if(data.data.id) {
if('users' in data.data && data.data.users.length > 0) {
if (data.data.id) {
if ('users' in data.data && data.data.users.length > 0) {
var user_item;
$.each(data.field_data.users, function(k, v) {
if(v.id in data.field_data.old_list) {
if (v.id in data.field_data.old_list) {
user_item = {
user_id: v.id,
user_name: v.first_name + ' ' + v.last_name,
@ -146,19 +158,30 @@ define(function(require){
}
};
$('.rows', parent).append(monster.template(self, 'directory-userRow', user_item));
$('#option_user_'+v.id, parent).hide();
$('.rows', parent)
.append($(self.getTemplate({
name: 'userRow',
data: user_item,
submodule: 'directory'
})));
$('#option_user_' + v.id, parent).hide();
}
});
} else {
$('.rows', parent)
.empty()
.append($(self.getTemplate({
name: 'userRow',
submodule: 'directory'
})));
}
else {
$('.rows', parent).empty()
.append(monster.template(self, 'directory-userRow'));
}
}
else {
$('.rows', parent).empty()
.append(monster.template(self,'directory-userRow'));
} else {
$('.rows', parent)
.empty()
.append($(self.getTemplate({
name: 'userRow',
submodule: 'directory'
})));
}
},
@ -168,7 +191,7 @@ define(function(require){
self.directoryEdit(args.data, args.parent, args.target, args.callbacks, args.data_defaults);
},
directoryEdit: function(data, _parent, _target, _callbacks, data_defaults){
directoryEdit: function(data, _parent, _target, _callbacks, data_defaults) {
var self = this,
parent = _parent || $('#directory-content'),
target = _target || $('#directory-view', parent),
@ -196,93 +219,89 @@ define(function(require){
};
monster.parallel({
callflow_list: function(callback) {
self.callApi({
resource: 'callflow.list',
data: {
accountId: self.accountId,
filters: {
paginate: 'false'
callflow_list: function(callback) {
self.callApi({
resource: 'callflow.list',
data: {
accountId: self.accountId,
filters: {
paginate: 'false'
}
},
success: function(callflows) {
var list_callflows = [];
$.each(callflows.data, function() {
if (this.featurecode === false) {
list_callflows.push(this);
}
},
success: function(callflows) {
var list_callflows = [];
$.each(callflows.data, function() {
if(this.featurecode == false) {
list_callflows.push(this);
}
});
});
list_callflows.sort(function(a, b) {
var aName = (a.name || (a.numbers[0] + '')).toLowerCase(),
bName = (b.name || (b.numbers[0] + '')).toLowerCase();
list_callflows.sort(function(a, b) {
var aName = (a.name || (a.numbers[0] + '')).toLowerCase(),
bName = (b.name || (b.numbers[0] + '')).toLowerCase();
return aName > bName ? 1 : -1;
});
return aName > bName ? 1 : -1;
});
defaults.field_data.callflows = list_callflows;
defaults.field_data.callflows = list_callflows;
callback(null, callflows);
callback(null, callflows);
}
});
},
user_list: function(callback) {
self.callApi({
resource: 'user.list',
data: {
accountId: self.accountId,
filters: {
paginate: 'false'
}
});
},
user_list: function(callback) {
self.callApi({
resource: 'user.list',
data: {
accountId: self.accountId,
filters: {
paginate: 'false'
}
},
success: function(users) {
users.data.sort(function(a,b) {
var aName = (a.first_name + ' ' + a.last_name).toLowerCase(),
bName = (b.first_name + ' ' + b.last_name).toLowerCase();
return aName > bName ? 1 : -1;
});
},
success: function(users) {
users.data.sort(function(a, b) {
var aName = (a.first_name + ' ' + a.last_name).toLowerCase(),
bName = (b.first_name + ' ' + b.last_name).toLowerCase();
defaults.field_data.users = users.data;
return aName > bName ? 1 : -1;
});
callback(null, users);
}
});
},
directory_get: function(callback) {
if(typeof data === 'object' && data.id) {
self.directoryGet(data.id, function(directory, status) {
defaults.field_data.old_list = {};
if('users' in directory) {
$.each(directory.users, function(k, v) {
defaults.field_data.old_list[v.user_id] = v.callflow_id;
});
}
defaults.field_data.users = users.data;
callback(null, directory);
}
);
callback(null, users);
}
else {
callback(null, {});
}
}
});
},
function(err, results) {
var render_data = defaults;
directory_get: function(callback) {
if (typeof data === 'object' && data.id) {
self.directoryGet(data.id, function(directory, status) {
defaults.field_data.old_list = {};
if ('users' in directory) {
$.each(directory.users, function(k, v) {
defaults.field_data.old_list[v.user_id] = v.callflow_id;
});
}
if(typeof data === 'object' && data.id) {
render_data = $.extend(true, defaults, { data: results.directory_get });
callback(null, directory);
});
} else {
callback(null, {});
}
}
}, function(err, results) {
var render_data = defaults;
self.directoryRender(render_data, target, callbacks);
if (typeof data === 'object' && data.id) {
render_data = $.extend(true, defaults, { data: results.directory_get });
}
if(typeof callbacks.after_render == 'function') {
callbacks.after_render();
}
self.directoryRender(render_data, target, callbacks);
if (typeof callbacks.after_render === 'function') {
callbacks.after_render();
}
);
});
},
directoryPopupEdit: function(args) {
@ -299,14 +318,14 @@ define(function(require){
save_success: function(_data) {
popup.dialog('close');
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback(_data);
}
},
delete_success: function() {
popup.dialog('close');
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback({ data: {} });
}
},
@ -324,7 +343,7 @@ define(function(require){
},
directoryCleanFormData: function(form_data) {
if(!(form_data.max_dtmf > 0)) {
if (!(form_data.max_dtmf > 0)) {
delete form_data.max_dtmf;
}
@ -337,14 +356,13 @@ define(function(require){
var self = this,
normalized_data = self.directoryNormalizeData($.extend(true, {}, data.data, form_data));
if (typeof data.data == 'object' && data.data.id) {
if (typeof data.data === 'object' && data.data.id) {
self.directoryUpdate(normalized_data, function(_data, status) {
self.directoryUpdateUsers(data.field_data.user_list, _data.id, function() {
success && success(_data, status, 'update');
});
})
}
else {
});
} else {
self.directoryCreate(normalized_data, function(_data, status) {
self.directoryUpdateUsers(data.field_data.user_list, _data.id, function() {
success && success(_data, status, 'create');
@ -363,13 +381,12 @@ define(function(require){
userId: user_id
},
success: function(_data, status) {
if(callflow_id) {
if(!_data.data.directories || $.isArray(_data.data.directories)) {
if (callflow_id) {
if (!_data.data.directories || $.isArray(_data.data.directories)) {
_data.data.directories = {};
}
_data.data.directories[directory_id] = callflow_id;
}
else {
} else {
delete _data.data.directories[directory_id];
}
@ -394,14 +411,14 @@ define(function(require){
users_count = 0,
callback = function() {
users_updated_count++;
if(users_updated_count >= users_count) {
if (users_updated_count >= users_count) {
success();
}
};
if(old_directory_user_list) {
$.each(old_directory_user_list, function(k, v) {
if(!(k in new_directory_user_list)) {
if (old_directory_user_list) {
$.each(old_directory_user_list, function(k) {
if (!(k in new_directory_user_list)) {
//Request to update user without this directory.
users_count++;
self.directoryUpdateSingleUser(k, directory_id, undefined, callback);
@ -409,22 +426,20 @@ define(function(require){
});
$.each(new_directory_user_list, function(k, v) {
if(k in old_directory_user_list) {
if(old_directory_user_list[k] != v) {
if (k in old_directory_user_list) {
if (old_directory_user_list[k] !== v) {
//Request to update user
users_count++;
self.directoryUpdateSingleUser(k, directory_id, v, callback);
}
//else it has not been updated
}
else {
} else {
users_count++;
self.directoryUpdateSingleUser(k, directory_id, v, callback);
}
});
}
else {
if(new_directory_user_list) {
} else {
if (new_directory_user_list) {
$.each(new_directory_user_list, function(k, v) {
users_count++;
self.directoryUpdateSingleUser(k, directory_id, v, callback);
@ -432,7 +447,7 @@ define(function(require){
}
}
if(users_count === 0) {
if (users_count === 0) {
success();
}
},
@ -463,7 +478,7 @@ define(function(require){
var id = node.getMetadata('id'),
returned_value = '';
if(id in caption_map) {
if (id in caption_map) {
returned_value = caption_map[id].name;
}
@ -475,18 +490,21 @@ define(function(require){
self.directoryList(function(directories) {
var popup, popup_html;
popup_html = $(monster.template(self, 'directory-callflowEdit', {
items: _.sortBy(directories, 'name'),
selected: node.getMetadata('id') || ''
popup_html = $(self.getTemplate({
name: 'callflowEdit',
data: {
items: _.sortBy(directories, 'name'),
selected: node.getMetadata('id') || ''
},
submodule: 'directory'
}));
if($('#directory_selector option:selected', popup_html).val() == undefined) {
if ($('#directory_selector option:selected', popup_html).val() === undefined) {
$('#edit_link', popup_html).hide();
}
$('.inline_action', popup_html).click(function(ev) {
var _data = ($(this).data('action') == 'edit') ?
{ id: $('#directory_selector', popup_html).val() } : {};
var _data = ($(this).data('action') === 'edit') ? { id: $('#directory_selector', popup_html).val() } : {};
ev.preventDefault();
@ -513,7 +531,7 @@ define(function(require){
popup = monster.ui.dialog(popup_html, {
title: self.i18n.active().callflows.directory.directory_title,
beforeClose: function() {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -525,7 +543,9 @@ define(function(require){
resource: 'directory.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: {
paginate: false
}
},
success: function(data, status) {
callback && callback(data.data);
@ -544,7 +564,9 @@ define(function(require){
resource: 'directory.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: {
paginate: false
}
},
success: function(data) {
callback && callback(data.data);
@ -559,7 +581,10 @@ define(function(require){
resource: 'directory.get',
data: {
accountId: self.accountId,
directoryId: directoryId
directoryId: directoryId,
filters: {
paginate: false
}
},
success: function(data) {
callback && callback(data.data);


src/apps/callflows/views/directory-callflowEdit.html → src/apps/callflows/submodules/directory/views/callflowEdit.html View File


src/apps/callflows/views/directory-edit.html → src/apps/callflows/submodules/directory/views/edit.html View File


src/apps/callflows/views/directory-userRow.html → src/apps/callflows/submodules/directory/views/userRow.html View File


+ 1
- 1
src/apps/callflows/submodules/faxbox/faxbox.css View File

@ -15,4 +15,4 @@
font-size: 13px;
font-weight: bold;
line-height: 30px;
}
}

+ 179
- 144
src/apps/callflows/submodules/faxbox/faxbox.js View File

@ -1,4 +1,4 @@
define(function(require){
define(function(require) {
var $ = require('jquery'),
_ = require('lodash'),
monster = require('monster'),
@ -37,7 +37,7 @@ define(function(require){
var id = node.getMetadata('id'),
returned_value = '';
if(id in caption_map) {
if (id in caption_map) {
returned_value = caption_map[id].name;
}
@ -47,19 +47,22 @@ define(function(require){
var _this = this;
self.faxboxList(function(data, status) {
var popup_html = $(monster.template(self, 'faxbox-callflowEdit', {
items: _.sortBy(data, 'name'),
selected: node.getMetadata('id') || ''
var popup_html = $(self.getTemplate({
name: 'callflowEdit',
data: {
items: _.sortBy(data, 'name'),
selected: node.getMetadata('id') || ''
},
submodule: 'faxbox'
})),
popup;
if($('#faxbox_selector option:selected', popup_html).val() == undefined) {
if ($('#faxbox_selector option:selected', popup_html).val() === undefined) {
$('#edit_link', popup_html).hide();
}
$('.inline_action', popup_html).click(function(ev) {
var _data = ($(this).data('action') == 'edit') ?
{ id: $('#faxbox_selector', popup_html).val() } : {};
var _data = ($(this).data('action') === 'edit') ? { id: $('#faxbox_selector', popup_html).val() } : {};
ev.preventDefault();
@ -87,7 +90,7 @@ define(function(require){
title: self.i18n.active().callflows.faxbox.voicemail_title,
minHeight: '0',
beforeClose: function() {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -99,7 +102,9 @@ define(function(require){
resource: 'faxbox.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: {
paginate: false
}
},
success: function(data, status) {
callback && callback(data.data);
@ -123,14 +128,14 @@ define(function(require){
save_success: function(_data) {
popup.dialog('close');
if ( typeof callback == 'function' ) {
if (typeof callback === 'function') {
callback(_data);
}
},
delete_success: function() {
popup.dialog('close');
if ( typeof callback == 'function' ) {
if (typeof callback === 'function') {
callback({ data: {} });
}
},
@ -155,9 +160,9 @@ define(function(require){
_callbacks = _callbacks || {},
callbacks = {
save_success: _callbacks.save_success || function(_data) {
self.faxboxRenderList(parent);
self.faxboxRenderList(parent);
self.faxboxEdit({ id: _data.id }, parent, target, callbacks);
self.faxboxEdit({ id: _data.id }, parent, target, callbacks);
},
delete_success: _callbacks.delete_success || function() {
target.empty();
@ -169,84 +174,114 @@ define(function(require){
};
monster.parallel({
faxbox: function(callback) {
if (typeof data === 'object' && data.id) {
self.faxboxGet(data.id, function(_data, status) {
_data.id = data.id;
faxbox: function(callback) {
if (typeof data === 'object' && data.id) {
self.faxboxGet(data.id, function(_data, status) {
_data.id = data.id;
callback(null, _data);
callback(null, _data);
});
} else {
callback(null, {});
}
},
user_list: function(callback) {
self.callApi({
resource: 'user.list',
data: {
accountId: self.accountId,
filters: {
paginate: false
}
},
success: function(_data, status) {
_data.data.sort(function(a, b) {
if (a.hasOwnProperty('first_name') && a.hasOwnProperty('last_name') && b.hasOwnProperty('first_name') && b.hasOwnProperty('last_name')) {
return a.first_name.concat(' ', a.last_name).toLowerCase() > b.first_name.concat(' ', b.last_name).toLowerCase() ? 1 : -1;
} else {
return 1;
}
});
} else {
callback(null, {});
}
},
user_list: function(callback) {
self.callApi({
resource: 'user.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
},
success: function(_data, status) {
_data.data.sort(function(a, b){
if(a.hasOwnProperty('first_name') && a.hasOwnProperty('last_name') && b.hasOwnProperty('first_name') && b.hasOwnProperty('last_name')) {
return a.first_name.concat(' ', a.last_name).toLowerCase() > b.first_name.concat(' ', b.last_name).toLowerCase() ? 1 : -1;
}
else {
return 1;
}
});
_data.data.unshift({
id: '',
first_name: self.i18n.active().callflows.faxbox.no,
last_name: self.i18n.active().callflows.faxbox.owner
});
callback(null, _data.data);
}
});
},
current_user: function(callback) {
if (!monster.util.isMasquerading()) {
self.faxboxGetUser(self.userId, function(_data, status) {
callback(null, _data);
_data.data.unshift({
id: '',
first_name: self.i18n.active().callflows.faxbox.no,
last_name: self.i18n.active().callflows.faxbox.owner
});
callback(null, _data.data);
}
else {
callback(null, {});
}
});
},
current_user: function(callback) {
if (!monster.util.isMasquerading()) {
self.faxboxGetUser(self.userId, function(_data, status) {
callback(null, _data);
});
} else {
callback(null, {});
}
},
function(err, results) {
if (!data.hasOwnProperty('id')) {
if (_.size(results.current_user) === 0) {
results.faxbox = $.extend(true, self.faxboxGetDefaultSettings(), results.faxbox);
}
else {
results.faxbox = $.extend(true, self.faxboxGetDefaultSettings(results.current_user), results.faxbox);
phone_numbers: function(callback) {
self.callApi({
resource: 'numbers.list',
data: {
accountId: self.accountId,
filters: {
paginate: false
}
},
success: function(_data) {
_data.numbers = _.chain(_data)
.get('data.numbers', {})
.keys()
.sortBy()
.value();
callback(null, _data.numbers);
}
});
}
}, function(err, results) {
if (!data.hasOwnProperty('id')) {
if (_.size(results.current_user) === 0) {
results.faxbox = $.extend(true, self.faxboxGetDefaultSettings(), results.faxbox);
} else {
results.faxbox = $.extend(true, self.faxboxGetDefaultSettings(results.current_user), results.faxbox);
}
}
delete results.current_user;
delete results.current_user;
self.faxboxRender(results, target, callbacks);
var invalidCallerID = _.find(results.phone_numbers, _.get(results.faxbox, 'caller_id', null));
if (typeof callbacks.after_render === 'function') {
callbacks.after_render();
}
if (!invalidCallerID) {
results.phone_numbers.unshift(results.faxbox.caller_id);
}
);
self.faxboxRender(results, target, callbacks);
if (typeof callbacks.after_render === 'function') {
callbacks.after_render();
}
});
},
faxboxRender: function(data, target, callbacks) {
var self = this,
faxbox_html = $(monster.template(self, 'faxbox-edit', {
faxbox: self.faxboxNormalizedData(data.faxbox),
users: data.user_list
faxbox_html = $(self.getTemplate({
name: 'edit',
data: {
faxbox: self.faxboxNormalizedData(data.faxbox),
users: data.user_list,
phone_numbers: data.phone_numbers
},
submodule: 'faxbox'
}));
timezone.populateDropdown($('#fax_timezone', faxbox_html), data.faxbox.fax_timezone||'inherit', {inherit: self.i18n.active().defaultTimezone});
monster.ui.chosen(faxbox_html.find('.callflows-caller-id-dropdown'));
timezone.populateDropdown($('#fax_timezone', faxbox_html), data.faxbox.fax_timezone || 'inherit', {inherit: self.i18n.active().defaultTimezone});
$('*[rel=popover]:not([type="text"])', faxbox_html).popover({
trigger: 'hover'
@ -261,7 +296,7 @@ define(function(require){
if (!data.faxbox.hasOwnProperty('id')) {
$('#owner_id', faxbox_html).change(function(ev) {
if ($(this).val()) {
self.faxboxGetUser($(this).val(),function(_data, status) {
self.faxboxGetUser($(this).val(), function(_data, status) {
data.faxbox = self.faxboxGetDefaultSettings(_data);
$('#edit_link', faxbox_html).show();
self.faxboxRender(data, target, callbacks);
@ -272,8 +307,7 @@ define(function(require){
self.faxboxRender(data, target, callbacks);
}
});
}
else {
} else {
$('#owner_id', faxbox_html).change(function(ev) {
var currentFaxbox = monster.ui.getFormData('faxbox_form');
@ -302,8 +336,7 @@ define(function(require){
$('#edit_link', faxbox_html).hide();
self.faxboxRender(data, target, callbacks);
});
}
else {
} else {
$('[id$="bound_notification_email"]', faxbox_html).each(function(idx, el) {
$(el).attr('disabled', false);
});
@ -311,30 +344,28 @@ define(function(require){
});
}
if(!$('#owner_id', faxbox_html).val()) {
if (!$('#owner_id', faxbox_html).val()) {
$('#edit_link', faxbox_html).hide();
}
$('.inline-action', faxbox_html).click(function(ev) {
var _data = $(this).data('action') == 'edit' ? { id: $('#owner_id', faxbox_html).val() } : {},
var _data = $(this).data('action') === 'edit' ? { id: $('#owner_id', faxbox_html).val() } : {},
_id = _data.id;
monster.pub('callflows.user.popupEdit', {
data: _data,
callflow: function(_data) {
/* Create */
if(!_id) {
$('#owner_id', faxbox_html).append('<option id="'+ _data.id +'" value="'+ _data.id +'">'+ _data.first_name + ' ' + _data.last_name +'</option>')
if (!_id) {
$('#owner_id', faxbox_html).append('<option id="' + _data.id + '" value="' + _data.id + '">' + _data.first_name + ' ' + _data.last_name + '</option>');
$('#owner_id', faxbox_html).val(_data.id);
}
else {
} else {
/* Update */
if('id' in _data) {
$('#owner_id #'+_data.id, faxbox_html).text(_data.first_name + ' ' + _data.last_name);
}
if ('id' in _data) {
$('#owner_id #' + _data.id, faxbox_html).text(_data.first_name + ' ' + _data.last_name);
/* Delete */
else {
$('#owner_id #'+_id, faxbox_html).remove();
} else {
$('#owner_id #' + _id, faxbox_html).remove();
}
}
}
@ -350,7 +381,7 @@ define(function(require){
fax_identity.val(number.replace(/^\+1([0-9]{3})([0-9]{3})([0-9]{4})$/, '+1 ($1) $2-$3'));
} else if (/^1([0-9]{10})$/.test(number)) {
fax_identity.val(number.replace(/^1([0-9]{3})([0-9]{3})([0-9]{4})$/, '+1 ($1) $2-$3'));
} else {
} else {
fax_identity.val(number.replace(/^([0-9]{3})([0-9]{3})([0-9]{4})$/, '+1 ($1) $2-$3'));
}
} else {
@ -363,7 +394,7 @@ define(function(require){
var form_html = $('#faxbox_form', faxbox_html),
form_data = monster.ui.getFormData('faxbox_form'),
word_reg = /^[\w\s'-]+/
word_reg = /^[\w\s'-]+/;
monster.ui.validate(form_html, {
rules: {
@ -395,7 +426,7 @@ define(function(require){
var $this = $(this);
if(!$this.hasClass('disabled')) {
if (!$this.hasClass('disabled')) {
$this.addClass('disabled');
if (monster.ui.valid(form_html)) {
@ -405,8 +436,7 @@ define(function(require){
}, function(data) {
$this.removeClass('disabled');
});
}
else {
} else {
$this.removeClass('disabled');
}
}
@ -432,7 +462,7 @@ define(function(require){
var map_crossbar_data = function(data) {
var new_list = [];
if(data.length > 0) {
if (data.length > 0) {
$.each(data, function(key, val) {
new_list.push({
id: val.id,
@ -457,7 +487,7 @@ define(function(require){
caller_name: '',
fax_header: '',
fax_timezone: 'inherit',
retries: 1,
retries: 3,
notifications: {
inbound: {
email: {
@ -476,24 +506,23 @@ define(function(require){
return default_faxbox;
} else {
return $.extend(true, {}, default_faxbox, {
name: user.first_name.concat(' ', user.last_name, self.i18n.active().callflows.faxbox.default_settings_name_extension),
caller_name: user.first_name.concat(' ', user.last_name),
fax_header: monster.config.whitelabel.companyName.concat(self.i18n.active().callflows.faxbox.default_settings_header_extension),
owner_id: user.id,
notifications: {
inbound: {
email: {
send_to: user.email || user.username
}
},
outbound: {
email: {
send_to: user.email || user.username
}
}
name: user.first_name.concat(' ', user.last_name, self.i18n.active().callflows.faxbox.default_settings_name_extension),
caller_name: user.first_name.concat(' ', user.last_name),
fax_header: monster.config.whitelabel.companyName.concat(self.i18n.active().callflows.faxbox.default_settings_header_extension),
owner_id: user.id,
notifications: {
inbound: {
email: {
send_to: user.email || user.username
}
},
outbound: {
email: {
send_to: user.email || user.username
}
}
);
}
});
}
},
@ -501,47 +530,47 @@ define(function(require){
var self = this,
normalized_data = self.faxboxNormalizedData($.extend(true, {}, data, form_data));
if(typeof data == 'object' && data.id) {
if (typeof data === 'object' && data.id) {
self.faxboxUpdate(normalized_data, function(_data, status) {
if(typeof success == 'function') {
success(_data, status, 'update');
}
},
function(_data, status) {
if(typeof error == 'function') {
error(_data, status, 'update');
}
if (typeof success === 'function') {
success(_data, status, 'update');
}
);
}, function(_data, status) {
if (typeof error === 'function') {
error(_data, status, 'update');
}
});
} else {
self.faxboxCreate(normalized_data, function(_data, status) {
if(typeof success == 'function') {
success(_data, status, 'create');
}
},
function(_data, status) {
if(typeof error == 'function') {
error(_data, status, 'create');
}
if (typeof success === 'function') {
success(_data, status, 'create');
}
);
}, function(_data, status) {
if (typeof error === 'function') {
error(_data, status, 'create');
}
});
}
},
faxboxNormalizedData: function(form_data) {
if (form_data.hasOwnProperty('notifications')) {
if (form_data.notifications.hasOwnProperty('inbound') && form_data.notifications.inbound.hasOwnProperty('email') && form_data.notifications.inbound.email.hasOwnProperty('send_to') && form_data.notifications.inbound.email.send_to.length) {
var inbound = form_data.notifications.inbound.email.send_to;
form_data.notifications.inbound.email.send_to = inbound instanceof Array ? inbound.join(',') : inbound.replace(/\s/g, '').split(',');
} else {
delete form_data.notifications.inbound.email.send_to;
if (form_data.notifications.hasOwnProperty('inbound') && form_data.notifications.inbound.hasOwnProperty('email') && form_data.notifications.inbound.email.hasOwnProperty('send_to')) {
if (form_data.notifications.inbound.email.send_to.length) {
var inbound = form_data.notifications.inbound.email.send_to;
form_data.notifications.inbound.email.send_to = inbound instanceof Array ? inbound.join(',') : inbound.replace(/\s/g, '').split(',');
} else {
delete form_data.notifications.inbound.email.send_to;
}
}
if (form_data.notifications.hasOwnProperty('outbound') && form_data.notifications.outbound.hasOwnProperty('email') && form_data.notifications.outbound.email.hasOwnProperty('send_to') && form_data.notifications.outbound.email.send_to.length) {
var outbound = form_data.notifications.outbound.email.send_to;
form_data.notifications.outbound.email.send_to = outbound instanceof Array ? outbound.join(',') : outbound.replace(/\s/g, '').split(',');
} else {
delete form_data.notifications.outbound.email.send_to;
if (form_data.notifications.hasOwnProperty('outbound') && form_data.notifications.outbound.hasOwnProperty('email') && form_data.notifications.outbound.email.hasOwnProperty('send_to')) {
if (form_data.notifications.outbound.email.send_to.length) {
var outbound = form_data.notifications.outbound.email.send_to;
form_data.notifications.outbound.email.send_to = outbound instanceof Array ? outbound.join(',') : outbound.replace(/\s/g, '').split(',');
} else {
delete form_data.notifications.outbound.email.send_to;
}
}
}
@ -551,7 +580,7 @@ define(function(require){
} else {
var list = form_data.smtp_permission_list;
form_data.smtp_permission_list = list instanceof Array ? list.join(',') : list.replace(/\s/g, '').split(',');
form_data.smtp_permission_list = list instanceof Array ? list.join(',') : list.replace(/\s/g, '').split(',');
}
}
@ -563,10 +592,14 @@ define(function(require){
delete form_data.owner_id;
}
if(form_data.fax_timezone && form_data.fax_timezone === 'inherit') {
if (form_data.fax_timezone && form_data.fax_timezone === 'inherit') {
delete form_data.fax_timezone;
}
if (form_data.caller_id === '_disabled') {
delete form_data.caller_id;
}
return form_data;
},
@ -577,7 +610,9 @@ define(function(require){
resource: 'faxbox.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: {
paginate: false
}
},
success: function(data) {
callback && callback(data.data);


src/apps/callflows/views/faxbox-callflowEdit.html → src/apps/callflows/submodules/faxbox/views/callflowEdit.html View File


src/apps/callflows/views/faxbox-edit.html → src/apps/callflows/submodules/faxbox/views/edit.html View File


+ 122
- 78
src/apps/callflows/submodules/featurecodes/featurecodes.js View File

@ -1,8 +1,7 @@
define(function(require){
define(function(require) {
var $ = require('jquery'),
_ = require('lodash'),
monster = require('monster'),
toastr = require('toastr');
monster = require('monster');
var app = {
requests: {},
@ -17,12 +16,17 @@ define(function(require){
self.featureCodeGetData(function(featureCodes) {
var formattedData = self.featureCodeFormatData(featureCodes),
template = $(monster.template(self, 'featurecodes-view', formattedData));
template = $(self.getTemplate({
name: 'view',
data: formattedData,
submodule: 'featurecodes'
}));
self.featureCodeBindEvents(template, formattedData.actions);
container.empty()
.append(template);
container
.empty()
.append(template);
});
},
@ -36,40 +40,53 @@ define(function(require){
featureCodeFormatData: function(data) {
var self = this,
actions = {},
categories = {},
formattedData = {
categories: {},
actions: {}
};
self.featureCodesDefine(actions);
_.each(data, function(callflow) {
if (callflow.hasOwnProperty('featurecode') && callflow.featurecode !== false) {
if (actions.hasOwnProperty(callflow.featurecode.name)) {
actions[callflow.featurecode.name].id = callflow.id;
actions[callflow.featurecode.name].enabled = true;
actions[callflow.featurecode.name].number = callflow.featurecode.number.replace('\\', '');
}
}
});
$.each(actions, function(i, action) {
this.tag = i;
this.number = typeof action.number === 'undefined' ? action.default_number : action.number;
this.hasConfig = this.hasOwnProperty('editConfiguration');
if (action.hasOwnProperty('category')) {
categories[action.category] = categories[action.category] || [];
categories[action.category].push(action);
}
});
formattedData.categories = categories;
formattedData.actions = actions;
return formattedData;
actions = self.featureCodesDefine();
return {
actions: _.transform(data, function(object, callflow) {
_.merge(object[callflow.featurecode.name], {
id: callflow.id,
enabled: true,
number: callflow.featurecode.number.replace('\\', '')
});
}, actions),
categories: _
.chain(actions)
.map(function(value, key) {
return _.merge(value, {
action: key
});
})
.groupBy('category')
.map(function(codes, category) {
return {
category: category,
items: _
.chain(codes)
.map(function(code) {
return _.merge({
hasConfig: _.isFunction(code.editConfiguration),
number: _.get(code, 'number', code.default_number),
tag: code.action
}, _.pick(code, [
'enabled',
'hasStar',
'id',
'name',
'number_type'
]));
})
.sortBy(function(code) {
var number = _.toNumber(code.number);
return _.isNaN(number) ? -1 : number;
})
.value()
};
})
.sortBy('category')
.value()
};
},
featureCodeBindEvents: function(template, actions) {
@ -98,9 +115,9 @@ define(function(require){
action_wrapper = $this.parents('.action_wrapper'),
number_field = action_wrapper.find('.featurecode-number');
if(!$this.is(':checked') && action_wrapper.data('enabled') === true) {
if (!$this.is(':checked') && action_wrapper.data('enabled') === true) {
action_wrapper.addClass('disabled');
} else if($this.is(':checked') && action_wrapper.data('enabled') === false){
} else if ($this.is(':checked') && action_wrapper.data('enabled') === false) {
action_wrapper.addClass('enabled');
} else {
action_wrapper.removeClass('enabled');
@ -113,13 +130,16 @@ define(function(require){
template.find('.featurecode-save').on('click', function(e) {
var $this = $(this);
e.preventDefault();
if(!$this.hasClass('disabled')) {
if (!$this.hasClass('disabled')) {
var formData = self.featureCodeCleanFormData(template, actions);
$this.addClass('disabled');
self.featureCodeMassUpdate(formData, function() {
toastr.success(self.i18n.active().callflows.featureCodes.successUpdate);
monster.ui.toast({
type: 'success',
message: self.i18n.active().callflows.featureCodes.successUpdate
});
$this.removeClass('disabled');
self.featureCodeRender();
@ -147,6 +167,7 @@ define(function(require){
data: {
accountId: self.accountId,
filters: {
has_key: 'featurecode.name',
paginate: false
}
},
@ -191,19 +212,18 @@ define(function(require){
children: {}
};
/* if(callflow.type === 'number') { callflow.type = 'numbers'}
if(callflow.type === 'pattern') { callflow.type = 'patterns'}*/
// if (callflow.type === 'number') { callflow.type = 'numbers'}
// if (callflow.type === 'pattern') { callflow.type = 'patterns'}
/* if a star is in the pattern, then we need to escape it */
if(callflow.type === 'patterns' && typeof callflow.number === 'string') {
callflow.number = callflow.number.replace(/([*])/g,'\\$1');
if (callflow.type === 'patterns' && typeof callflow.number === 'string') {
callflow.number = callflow.number.replace(/([*])/g, '\\$1');
}
callflow[callflow.type] = [actions[callflow.action].build_regex(callflow.number)];
form_data.created_callflows.push(callflow);
});
template.find('.disabled').each(function() {
var callflow = $(this).data();
@ -213,7 +233,7 @@ define(function(require){
});
template.find('.changed:not(.enabled, .disabled)').each(function() {
if($(this).data('enabled')) {
if ($(this).data('enabled')) {
var callflow = $(this).data();
// Casting in String, as back-end requires a String
@ -226,8 +246,8 @@ define(function(require){
};
/* if a star is in the pattern, then we need to escape it */
if(callflow.type === 'patterns') {
callflow.number = callflow.number.replace(/([*])/g,'\\$1');
if (callflow.type === 'patterns') {
callflow.number = callflow.number.replace(/([*])/g, '\\$1');
}
callflow[callflow.type] = [actions[callflow.action].build_regex(callflow.number)];
@ -289,7 +309,7 @@ define(function(require){
var self = this,
count = form_data.created_callflows.length + form_data.deleted_callflows.length + form_data.updated_callflows.length;
if(count) {
if (count) {
var parallelRequests = {};
_.each(form_data.created_callflows, function(callflow) {
@ -339,17 +359,35 @@ define(function(require){
monster.parallel(parallelRequests, function(err, results) {
callback && callback();
});
}
else {
} else {
errorCallback && errorCallback();
toastr.error(self.i18n.active().callflows.featureCodes.nothing_to_save);
monster.ui.toast({
type: 'error',
message: self.i18n.active().callflows.featureCodes.nothing_to_save
});
}
},
featureCodesDefine: function(featurecodes) {
var self = this;
$.extend(featurecodes, {
return {
directed_ext_pickup: {
name: self.i18n.active().callflows.featureCodes.directed_ext_pickup,
category: self.i18n.active().callflows.featureCodes.miscellaneous_cat,
module: 'group_pickup_feature',
number_type: 'patterns',
data: {
type: 'extension'
},
enabled: false,
hasStar: true,
default_number: '87',
number: this.default_number,
build_regex: function(number) {
return '^\\*' + number + '([0-9]+)$';
}
},
'call_forward[action=activate]': {
name: self.i18n.active().callflows.featureCodes.enable_call_forward,
icon: 'phone',
@ -364,7 +402,7 @@ define(function(require){
default_number: '72',
number: this.default_number,
build_regex: function(number) {
return '*'+number;
return '*' + number;
}
},
'call_forward[action=deactivate]': {
@ -381,7 +419,7 @@ define(function(require){
default_number: '73',
number: this.default_number,
build_regex: function(number) {
return '*'+number;
return '*' + number;
}
},
'call_forward[action=toggle]': {
@ -398,7 +436,7 @@ define(function(require){
default_number: '74',
number: this.default_number,
build_regex: function(number) {
return '^\\*'+number+'([0-9]*)$';
return '^\\*' + number + '([0-9]*)$';
}
},
'call_forward[action=update]': {
@ -415,7 +453,7 @@ define(function(require){
default_number: '56',
number: this.default_number,
build_regex: function(number) {
return '*'+number;
return '*' + number;
}
},
@ -433,7 +471,7 @@ define(function(require){
default_number: '11',
number: this.default_number,
build_regex: function(number) {
return '*'+number;
return '*' + number;
}
},
'hotdesk[action=logout]': {
@ -450,7 +488,7 @@ define(function(require){
default_number: '12',
number: this.default_number,
build_regex: function(number) {
return '*'+number;
return '*' + number;
}
},
'hotdesk[action=toggle]': {
@ -467,7 +505,7 @@ define(function(require){
default_number: '13',
number: this.default_number,
build_regex: function(number) {
return '*'+number;
return '*' + number;
}
},
'voicemail[action=check]': {
@ -484,7 +522,7 @@ define(function(require){
default_number: '97',
number: this.default_number,
build_regex: function(number) {
return '^\\*'+number+'([0-9]*)$';
return '^\\*' + number + '([0-9]*)$';
}
},
'voicemail[single_mailbox_login]': {
@ -502,7 +540,7 @@ define(function(require){
default_number: '98',
number: this.default_number,
build_regex: function(number) {
return '^\\*'+number+'([0-9]*)$';
return '^\\*' + number + '([0-9]*)$';
}
},
'voicemail[action="direct"]': {
@ -518,7 +556,7 @@ define(function(require){
default_number: '*',
number: this.default_number,
build_regex: function(number) {
return '^\\*'+number+'([0-9]*)$';
return '^\\*' + number + '([0-9]*)$';
}
},
'intercom': {
@ -534,7 +572,7 @@ define(function(require){
default_number: '0',
number: this.default_number,
build_regex: function(number) {
return '^\\*'+number+'([0-9]*)$';
return '^\\*' + number + '([0-9]*)$';
}
},
'privacy[mode=full]': {
@ -551,7 +589,7 @@ define(function(require){
default_number: '67',
number: this.default_number,
build_regex: function(number) {
return '^\\*'+number+'([0-9]*)$';
return '^\\*' + number + '([0-9]*)$';
}
},
'park_and_retrieve': {
@ -571,7 +609,7 @@ define(function(require){
default_number: '3',
number: this.default_number,
build_regex: function(number) {
return '^\\*'+number+'([0-9]*)$';
return '^\\*' + number + '([0-9]*)$';
}
},
'valet': {
@ -591,7 +629,7 @@ define(function(require){
default_number: '4',
number: this.default_number,
build_regex: function(number) {
return '*'+number;
return '*' + number;
}
},
'retrieve': {
@ -608,7 +646,7 @@ define(function(require){
default_number: '5',
number: this.default_number,
build_regex: function(number) {
return '^\\*'+number+'([0-9]*)$';
return '^\\*' + number + '([0-9]*)$';
}
},
'move': {
@ -626,7 +664,7 @@ define(function(require){
build_regex: function(number) {
return number;
}
},
}
/*'call_forward[action=on_busy_enable]': {
name: 'Enable Call-Forward on Busy',
icon: 'phone',
@ -850,7 +888,7 @@ define(function(require){
return '^\\*'+number+'([0-9]*)$';
}
}*/
});
};
},
featureCodesEditParkingParkAndRetrieve: function(featureCode) {
@ -860,7 +898,7 @@ define(function(require){
var popup,
formattedData = self.featureCodesFormatParkingData(data),
template = $(self.getTemplate({
name: 'featurecodes-parking-parkandretrieve',
name: 'parking-parkandretrieve',
submodule: 'featurecodes',
data: formattedData
}));
@ -886,7 +924,10 @@ define(function(require){
dataToUpdate = self.featureCodesNormalizeData(data, formData);
self.featureCodeUpdate(dataToUpdate.id, dataToUpdate, function() {
toastr.success(self.i18n.active().callflows.featureCodes.parkingParkAndRetrievePopup.successUpdate);
monster.ui.toast({
type: 'success',
message: self.i18n.active().callflows.featureCodes.parkingParkAndRetrievePopup.successUpdate
});
popup.dialog('close');
});
}
@ -905,7 +946,7 @@ define(function(require){
var popup,
formattedData = self.featureCodesFormatParkingData(data),
template = $(self.getTemplate({
name: 'featurecodes-parking-valet',
name: 'parking-valet',
submodule: 'featurecodes',
data: formattedData
}));
@ -931,7 +972,10 @@ define(function(require){
dataToUpdate = self.featureCodesNormalizeData(data, formData);
self.featureCodeUpdate(dataToUpdate.id, dataToUpdate, function() {
toastr.success(self.i18n.active().callflows.featureCodes.parkingValetPopup.successUpdate);
monster.ui.toast({
type: 'success',
message: self.i18n.active().callflows.featureCodes.parkingValetPopup.successUpdate
});
popup.dialog('close');
});
}


+ 28
- 0
src/apps/callflows/submodules/featurecodes/views/parking-parkandretrieve.html View File

@ -0,0 +1,28 @@
<div id="parking_settings_popup" class="dialog_popup callflows-port">
<div class="info-settings">
{{#monsterText 'info'}}
{{ i18n.callflows.featureCodes.infoSettings }}
{{/monsterText}}
</div>
<form id="form_park_retrieve" name="form" class="form-horizontal" method="post" action="#">
<div class="form_content">
<div class="control-group">
<label class="control-label">{{ i18n.callflows.featureCodes.parkingValetPopup.ringBackTimeout.label }}<i class="help-popover fa fa-question-circle" data-original-title="{{ i18n.callflows.featureCodes.parkingValetPopup.ringBackTimeout.tooltip}}" data-placement="right" data-toggle="tooltip"></i></label>
<div class="controls">
<input type="text" name="default_ringback_timeout" value="{{ default_ringback_timeout }}"/>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ i18n.callflows.featureCodes.parkingValetPopup.callbackTimeout.label }}<i class="help-popover fa fa-question-circle" data-original-title="{{ i18n.callflows.featureCodes.parkingValetPopup.callbackTimeout.tooltip}}" data-placement="right" data-toggle="tooltip"></i></label>
<div class="controls">
<input type="text" name="default_callback_timeout" value="{{ default_callback_timeout }}"/>
</div>
</div>
</form>
<div class="buttons-center">
<button id="save" class="monster-button monster-button-primary">{{ i18n.save }}</button>
</div>
</div>

+ 28
- 0
src/apps/callflows/submodules/featurecodes/views/parking-valet.html View File

@ -0,0 +1,28 @@
<div id="parking_settings_popup" class="dialog_popup callflows-port">
<div class="info-settings">
{{#monsterText 'info'}}
{{ i18n.callflows.featureCodes.infoSettings }}
{{/monsterText}}
</div>
<form id="form_valet" name="form" class="form-horizontal" method="post" action="#">
<div class="form_content">
<div class="control-group">
<label class="control-label">{{ i18n.callflows.featureCodes.parkingValetPopup.ringBackTimeout.label }}<i class="help-popover fa fa-question-circle" data-original-title="{{ i18n.callflows.featureCodes.parkingValetPopup.ringBackTimeout.tooltip}}" data-placement="right" data-toggle="tooltip"></i></label>
<div class="controls">
<input type="text" name="default_ringback_timeout" value="{{ default_ringback_timeout }}"/>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ i18n.callflows.featureCodes.parkingValetPopup.callbackTimeout.label }}<i class="help-popover fa fa-question-circle" data-original-title="{{ i18n.callflows.featureCodes.parkingValetPopup.callbackTimeout.tooltip}}" data-placement="right" data-toggle="tooltip"></i></label>
<div class="controls">
<input type="text" name="default_callback_timeout" value="{{ default_callback_timeout }}"/>
</div>
</div>
</form>
<div class="buttons-center">
<button id="save" class="monster-button monster-button-primary">{{ i18n.save }}</button>
</div>
</div>

src/apps/callflows/views/featurecodes-view.html → src/apps/callflows/submodules/featurecodes/views/view.html View File


+ 4
- 0
src/apps/callflows/submodules/groups/groups.css View File

@ -1,3 +1,7 @@
.callflows-port#ring_group_popup .shoutcast-div {
width: 350px;
}
.callflows-port#ring_group_popup .form_content .popup_field .media_action {
color: #05addc;
margin-left: 10px;


+ 442
- 332
src/apps/callflows/submodules/groups/groups.js
File diff suppressed because it is too large
View File


src/apps/callflows/views/misc-eavesdrop.html → src/apps/callflows/submodules/groups/views/eavesdrop.html View File


src/apps/callflows/views/groups-edit.html → src/apps/callflows/submodules/groups/views/edit.html View File


src/apps/callflows/views/groups-endpoint_row.html → src/apps/callflows/submodules/groups/views/endpoint_row.html View File


src/apps/callflows/views/misc-intercept.html → src/apps/callflows/submodules/groups/views/intercept.html View File


src/apps/callflows/views/groups-page_group_dialog.html → src/apps/callflows/submodules/groups/views/page_group_dialog.html View File


src/apps/callflows/views/groups-page_group_element.html → src/apps/callflows/submodules/groups/views/page_group_element.html View File


src/apps/callflows/views/groups-ring_group_dialog.html → src/apps/callflows/submodules/groups/views/ring_group_dialog.html View File


src/apps/callflows/views/groups-ring_group_element.html → src/apps/callflows/submodules/groups/views/ring_group_element.html View File


src/apps/callflows/views/groups-ring_group_login_dialog.html → src/apps/callflows/submodules/groups/views/ring_group_login_dialog.html View File


src/apps/callflows/views/groups-ring_group_logout_dialog.html → src/apps/callflows/submodules/groups/views/ring_group_logout_dialog.html View File


+ 76
- 70
src/apps/callflows/submodules/media/media.js View File

@ -1,4 +1,4 @@
define(function(require){
define(function(require) {
var $ = require('jquery'),
_ = require('lodash'),
monster = require('monster');
@ -14,8 +14,15 @@ define(function(require){
mediaRender: function(data, target, callbacks) {
var self = this,
media_html = $(monster.template(self, 'media-edit', data)),
mediaForm = media_html.find('#media-form');
media_html = $(self.getTemplate({
name: 'edit',
data: _.merge({
showMediaUploadDisclosure: monster.config.whitelabel.showMediaUploadDisclosure
}, data),
submodule: 'media'
})),
mediaForm = media_html.find('#media-form'),
file;
monster.ui.validate(mediaForm, {
rules: {
@ -35,7 +42,7 @@ define(function(require){
self.winkstartTabs(media_html);
if(data.data.id) {
if (data.data.id) {
$('#upload_div', media_html).hide();
}
@ -47,15 +54,15 @@ define(function(require){
$('#download_link', media_html).click(function(ev) {
ev.preventDefault();
window.location.href = self.apiUrl + (self.apiUrl.substring(self.apiUrl.length-1) != '/' ? '/' : '') + 'accounts/' +
self.accountId + '/media/' +
data.data.id + '/raw?auth_token=' + self.getAuthToken();
window.location.href = self.apiUrl + (self.apiUrl.substring(self.apiUrl.length - 1) !== '/' ? '/' : '')
+ 'accounts/' + self.accountId + '/media/' + data.data.id
+ '/raw?auth_token=' + self.getAuthToken();
});
$('#file', media_html).bind('change', function(evt){
$('#file', media_html).bind('change', function(evt) {
var files = evt.target.files;
if(files.length > 0) {
if (files.length > 0) {
var reader = new FileReader();
file = 'updating';
@ -63,7 +70,7 @@ define(function(require){
var data = evt.target.result;
file = data;
}
};
reader.readAsDataURL(files[0]);
}
@ -72,15 +79,12 @@ define(function(require){
function changeType($select) {
var type = $select.val();
switch(type) {
case 'tts':
$('.tts', media_html).show();
$('.file', media_html).hide();
break;
case 'upload':
$('.tts', media_html).hide();
$('.file', media_html).show();
break;
if (type === 'tts') {
$('.tts', media_html).show();
$('.file', media_html).hide();
} else if (type === 'upload') {
$('.tts', media_html).hide();
$('.file', media_html).show();
}
}
@ -94,31 +98,30 @@ define(function(require){
ev.preventDefault();
var $this = $(this);
if(!$this.hasClass('disabled')) {
if (!$this.hasClass('disabled')) {
$this.addClass('disabled');
if(monster.ui.valid(mediaForm)) {
if (monster.ui.valid(mediaForm)) {
var form_data = monster.ui.getFormData('media-form');
form_data = self.mediaCleanFormData(form_data);
self.mediaSave(form_data, data, function(_data, status) {
if(!form_data.tts) {
if($('#upload_div', media_html).is(':visible') && $('#file').val() != '') {
if(file === 'updating') {
if (!form_data.tts) {
if ($('#upload_div', media_html).is(':visible') && $('#file').val() !== '') {
if (file === 'updating') {
monster.ui.alert(self.i18n.active().callflows.media.the_file_you_want_to_apply);
$this.removeClass('disabled');
}
else {
} else {
self.mediaUpload(file, _data.id, function() {
if(typeof callbacks.save_success == 'function') {
if (typeof callbacks.save_success === 'function') {
callbacks.save_success(_data, status);
}
}, function() {
if(data && data.data && data.data.id) {
if (data && data.data && data.data.id) {
self.mediaSave({}, data, function() {
if(typeof callbacks.save_success == 'function') {
if (typeof callbacks.save_success === 'function') {
callbacks.save_success(_data, status);
}
});
@ -128,19 +131,18 @@ define(function(require){
$this.removeClass('disabled');
if(typeof callbacks.save_error == 'function') {
if (typeof callbacks.save_error === 'function') {
callbacks.save_error(_data, status);
}
});
}
}
else {
if(typeof callbacks.save_success == 'function') {
} else {
if (typeof callbacks.save_success === 'function') {
callbacks.save_success(_data, status);
}
}
} else {
if(typeof callbacks.save_success == 'function') {
if (typeof callbacks.save_success === 'function') {
callbacks.save_success(_data, status);
}
}
@ -168,12 +170,12 @@ define(function(require){
mediaCleanFormData: function(form_data) {
form_data.description = form_data.upload_media;
if(form_data.description == '') {
if (form_data.description === '') {
delete form_data.description;
}
if(form_data.media_source == 'tts') {
form_data.description = "tts file";
if (form_data.media_source === 'tts') {
form_data.description = 'tts file';
} else {
delete form_data.tts;
}
@ -189,7 +191,7 @@ define(function(require){
self.mediaEdit(args.data, args.parent, args.target, args.callbacks, args.data_defaults);
},
mediaEdit: function(data, _parent, _target, _callbacks, data_defaults){
mediaEdit: function(data, _parent, _target, _callbacks, data_defaults) {
var self = this,
parent = _parent || $('#media-content'),
target = _target || $('#media-view', parent),
@ -207,21 +209,20 @@ define(function(require){
}, data_defaults || {})
};
if(typeof data == 'object' && data.id) {
if (typeof data === 'object' && data.id) {
self.mediaGet(data.id, function(mediaData) {
self.mediaFormatData(mediaData);
self.mediaRender($.extend(true, defaults, { data: mediaData }), target, callbacks);
if(typeof callbacks.after_render == 'function') {
if (typeof callbacks.after_render === 'function') {
callbacks.after_render();
}
});
}
else {
} else {
self.mediaRender(defaults, target, callbacks);
if(typeof callbacks.after_render == 'function') {
if (typeof callbacks.after_render === 'function') {
callbacks.after_render();
}
}
@ -231,16 +232,15 @@ define(function(require){
var self = this,
normalized_data = self.mediaNormalizeData($.extend(true, {}, data.data, form_data));
if(typeof data.data == 'object' && data.data.id) {
if (typeof data.data === 'object' && data.data.id) {
self.mediaUpdate(normalized_data, function(_data, status) {
if(typeof success == 'function') {
if (typeof success === 'function') {
success(_data, status, 'update');
}
});
}
else {
} else {
self.mediaCreate(normalized_data, function(_data, status) {
if(typeof success == 'function') {
if (typeof success === 'function') {
success(_data, status, 'create');
}
});
@ -250,11 +250,11 @@ define(function(require){
mediaNormalizeData: function(form_data) {
delete form_data.upload_media;
if('field_data' in form_data) {
if ('field_data' in form_data) {
delete form_data.field_data;
}
if(form_data.media_source == 'upload') {
if (form_data.media_source === 'upload') {
delete form_data.tts;
}
@ -266,14 +266,13 @@ define(function(require){
* And as we're using the same template for both behaviors, we need the same kind of data.
* TODO: delete once this bug is fixed!
*/
if(data.streamable == 'false') {
data.streamable = false;
}
else if(data.streamable == 'true') {
if (data.streamable === 'false') {
data.streamable = false;
} else if (data.streamable === 'true') {
data.streamable = true;
}
if(data.description != undefined && data.description.substr(0,12) == 'C:\\fakepath\\') {
if (data.description !== undefined && data.description.substr(0, 12) === 'C:\\fakepath\\') {
data.description = data.description.substr(12);
}
@ -292,14 +291,14 @@ define(function(require){
save_success: function(_data) {
popup.dialog('close');
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback(_data);
}
},
delete_success: function() {
popup.dialog('close');
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback({ data: {} });
}
},
@ -339,7 +338,7 @@ define(function(require){
isShoutcast = id && id.indexOf('://') >= 0 && !isSilence,
returned_value = '';
if(id in caption_map) {
if (id in caption_map) {
returned_value = caption_map[id].name;
} else if (isShoutcast) {
returned_value = id;
@ -358,21 +357,24 @@ define(function(require){
isSilence = !mediaId || (mediaId && mediaId === 'silence_stream://300000'), // because silence is the default choice, we test for !mediaId
isShoutcast = mediaId.indexOf('://') >= 0 && mediaId !== 'silence_stream://300000';
popup_html = $(monster.template(self, 'media-callflowEdit', {
items: medias,
selected: isShoutcast ? 'shoutcast' : mediaId,
isShoutcast: isShoutcast,
shoutcastValue: mediaId,
isEditable: !isShoutcast && !isSilence
popup_html = $(self.getTemplate({
name: 'callflowEdit',
data: {
items: medias,
selected: isShoutcast ? 'shoutcast' : mediaId,
isShoutcast: isShoutcast,
shoutcastValue: mediaId,
isEditable: !isShoutcast && !isSilence
},
submodule: 'media'
}));
if($('#media_selector option:selected', popup_html).val() == undefined) {
if ($('#media_selector option:selected', popup_html).val() === undefined) {
$('#edit_link', popup_html).hide();
}
$('.inline_action', popup_html).click(function(ev) {
var _data = ($(this).data('action') == 'edit') ?
{ id: $('#media_selector', popup_html).val() } : {};
var _data = ($(this).data('action') === 'edit') ? { id: $('#media_selector', popup_html).val() } : {};
ev.preventDefault();
@ -414,7 +416,7 @@ define(function(require){
title: self.i18n.active().callflows.media.media,
minHeight: '0',
beforeClose: function() {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -426,7 +428,9 @@ define(function(require){
resource: 'media.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: {
paginate: false
}
},
success: function(data, status) {
callback && callback(data.data);
@ -445,7 +449,9 @@ define(function(require){
resource: 'media.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: {
paginate: false
}
},
success: function(data) {
var mediaList = _.sortBy(data.data, function(item) { return item.name.toLowerCase(); });


src/apps/callflows/views/media-callflowEdit.html → src/apps/callflows/submodules/media/views/callflowEdit.html View File


src/apps/callflows/views/media-edit.html → src/apps/callflows/submodules/media/views/edit.html View File


+ 114
- 107
src/apps/callflows/submodules/menu/menu.js View File

@ -1,4 +1,4 @@
define(function(require){
define(function(require) {
var $ = require('jquery'),
_ = require('lodash'),
monster = require('monster');
@ -45,58 +45,57 @@ define(function(require){
};
monster.parallel({
media_list: function(callback) {
self.callApi({
resource: 'media.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
},
success: function(mediaList, status) {
_.each(mediaList.data, function(media) {
if(media.media_source) {
media.name = '['+media.media_source.substring(0,3).toUpperCase()+'] ' + media.name;
}
});
mediaList.data.unshift({
id: '',
name: self.i18n.active().callflows.menu.not_set
});
defaults.field_data.media = mediaList.data;
callback(null, mediaList);
media_list: function(callback) {
self.callApi({
resource: 'media.list',
data: {
accountId: self.accountId,
filters: {
paginate: false
}
});
},
menu_get: function(callback) {
if(typeof data == 'object' && data.id) {
self.menuGet(data.id, function(menuData, status) {
self.menuformatData(menuData);
},
success: function(mediaList, status) {
_.each(mediaList.data, function(media) {
if (media.media_source) {
media.name = '[' + media.media_source.substring(0, 3).toUpperCase() + '] ' + media.name;
}
});
callback(null, { data: menuData });
mediaList.data.unshift({
id: '',
name: self.i18n.active().callflows.menu.not_set
});
defaults.field_data.media = mediaList.data;
callback(null, mediaList);
}
else {
callback(null, {});
}
}
});
},
function(err, results) {
var render_data = defaults;
menu_get: function(callback) {
if (typeof data === 'object' && data.id) {
self.menuGet(data.id, function(menuData, status) {
self.menuformatData(menuData);
if(typeof data === 'object' && data.id) {
render_data = $.extend(true, defaults, results.menu_get)
callback(null, { data: menuData });
});
} else {
callback(null, {});
}
}
}, function(err, results) {
var render_data = defaults;
self.menuRender(render_data, target, callbacks);
if (typeof data === 'object' && data.id) {
render_data = $.extend(true, defaults, results.menu_get);
}
if(typeof callbacks.after_render == 'function') {
callbacks.after_render();
}
self.menuRender(render_data, target, callbacks);
if (typeof callbacks.after_render === 'function') {
callbacks.after_render();
}
);
});
},
menuPopupEdit: function(data, callback, data_defaults) {
@ -108,14 +107,14 @@ define(function(require){
save_success: function(_data) {
popup.dialog('close');
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback(_data);
}
},
delete_success: function() {
popup.dialog('close');
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback({ data: {} });
}
},
@ -127,9 +126,13 @@ define(function(require){
}, data_defaults);
},
menuRender: function(data, target, callbacks){
menuRender: function(data, target, callbacks) {
var self = this,
menu_html = $(monster.template(self, 'menu-edit', data)),
menu_html = $(self.getTemplate({
name: 'edit',
data: data,
submodule: 'menu'
})),
menuForm = menu_html.find('#menu-form');
monster.ui.validate(menuForm, {
@ -165,7 +168,7 @@ define(function(require){
self.winkstartTabs(menu_html);
if(!$('#media_greeting', menu_html).val()) {
if (!$('#media_greeting', menu_html).val()) {
$('#edit_link_media', menu_html).hide();
}
@ -174,7 +177,7 @@ define(function(require){
});
$('.inline_action_media', menu_html).click(function(ev) {
var _data = ($(this).data('action') == 'edit') ? { id: $('#media_greeting', menu_html).val() } : {},
var _data = ($(this).data('action') === 'edit') ? { id: $('#media_greeting', menu_html).val() } : {},
_id = _data.id;
ev.preventDefault();
@ -185,20 +188,18 @@ define(function(require){
/* Create */
dataMedia.name = '[UPL] ' + dataMedia.name;
if(!_id) {
$('#media_greeting', menu_html).append('<option id="'+ dataMedia.id +'" value="'+ dataMedia.id +'">'+ dataMedia.name +'</option>')
if (!_id) {
$('#media_greeting', menu_html).append('<option id="' + dataMedia.id + '" value="' + dataMedia.id + '">' + dataMedia.name + '</option>');
$('#media_greeting', menu_html).val(dataMedia.id);
$('#edit_link_media', menu_html).show();
}
else {
} else {
/* Update */
if(dataMedia.hasOwnProperty('id')) {
$('#media_greeting #'+dataMedia.id, menu_html).text(dataMedia.name);
}
if (dataMedia.hasOwnProperty('id')) {
$('#media_greeting #' + dataMedia.id, menu_html).text(dataMedia.name);
/* Delete */
else {
$('#media_greeting #'+_id, menu_html).remove();
} else {
$('#media_greeting #' + _id, menu_html).remove();
$('#edit_link_media', menu_html).hide();
}
}
@ -211,15 +212,15 @@ define(function(require){
var $this = $(this);
if(!$this.hasClass('disabled')) {
if (!$this.hasClass('disabled')) {
$this.addClass('disabled');
if(monster.ui.valid(menuForm)) {
if (monster.ui.valid(menuForm)) {
var form_data = monster.ui.getFormData('menu-form');
self.menuCleanFormData(form_data);
if('field_data' in data) {
if ('field_data' in data) {
delete data.field_data;
}
@ -250,7 +251,7 @@ define(function(require){
var self = this,
normalized_data = self.menuNormalizeData($.extend(true, {}, data.data, form_data));
if (typeof data.data == 'object' && data.data.id) {
if (typeof data.data === 'object' && data.data.id) {
self.menuUpdate(normalized_data, function(data, status) {
success && success(data, status, 'update');
}, error);
@ -271,26 +272,21 @@ define(function(require){
data.timeout /= 1000; // ms to seconds
}
if(data.interdigit_timeout) {
if (data.interdigit_timeout) {
data.interdigit_timeout /= 1000; // ms to seconds
}
if(data.media) {
if(data.media.invalid_media === false && data.media.transfer_media === false && data.media.exit_media === false) {
if (data.media) {
if (data.media.invalid_media === false && data.media.transfer_media === false && data.media.exit_media === false) {
data.suppress_media = true;
}
else {
} else {
data.suppress_media = false;
}
}
},
menuCleanFormData: function(form_data) {
if(form_data.record_pin.length == 0) {
form_data.max_extension_length = 4;
}
else if(form_data.max_extension_length < form_data.record_pin.length) {
if (form_data.max_extension_length < form_data.record_pin.length) {
form_data.max_extension_length = form_data.record_pin.length;
}
@ -302,12 +298,11 @@ define(function(require){
if ('suppress_media' in form_data) {
form_data.media = form_data.media || {};
if(form_data.suppress_media === true) {
if (form_data.suppress_media === true) {
form_data.media.invalid_media = false;
form_data.media.transfer_media = false;
form_data.media.exit_media = false;
}
else {
} else {
form_data.media.invalid_media = true;
form_data.media.transfer_media = true;
form_data.media.exit_media = true;
@ -316,19 +311,19 @@ define(function(require){
},
menuNormalizeData: function(form_data) {
if(!form_data.media.greeting) {
if (!form_data.media.greeting) {
delete form_data.media.greeting;
}
if(form_data.hunt_allow == '') {
if (form_data.hunt_allow === '') {
delete form_data.hunt_allow;
}
if(form_data.hunt_deny == '') {
if (form_data.hunt_deny === '') {
delete form_data.hunt_deny;
}
if(form_data.record_pin == '') {
if (form_data.record_pin === '') {
delete form_data.record_pin;
}
@ -359,10 +354,10 @@ define(function(require){
],
isUsable: 'true',
weight: 60,
key_caption: function(child_node, caption_map) {
key_caption: function(child_node) {
var key = child_node.key;
return (key != '_') ? key : self.i18n.active().callflows.menu.default_action;
return (key !== '_') ? key : self.i18n.active().callflows.menu.default_action;
},
key_edit: function(child_node, callback) {
var popup, popup_html;
@ -371,23 +366,28 @@ define(function(require){
The '#' Key is only displayed if it exists in the callflow, otherwise it is hidden by the template (see /tmpl/menu_key_callflow.html)
*/
popup_html = $(monster.template(self, 'menu-callflowKey', {
items: {
'_': self.i18n.active().callflows.menu.default_action,
'0': '0',
'1': '1',
'2': '2',
'3': '3',
'4': '4',
'5': '5',
'6': '6',
'7': '7',
'8': '8',
'9': '9',
'*': '*',
'#': '#'
popup_html = $(self.getTemplate({
name: 'callflowKey',
data: {
items: {
'_': self.i18n.active().callflows.menu.default_action,
'timeout': 'timeout',
'0': '0',
'1': '1',
'2': '2',
'3': '3',
'4': '4',
'5': '5',
'6': '6',
'7': '7',
'8': '8',
'9': '9',
'*': '*',
'#': '#'
},
selected: child_node.key
},
selected: child_node.key
submodule: 'menu'
}));
popup_html.find('#add').on('click', function() {
@ -410,7 +410,7 @@ define(function(require){
var id = node.getMetadata('id'),
returned_value = '';
if(id in caption_map) {
if (id in caption_map) {
returned_value = caption_map[id].name;
}
@ -422,18 +422,21 @@ define(function(require){
self.menuList(function(menus) {
var popup, popup_html;
popup_html = $(monster.template(self, 'menu-callflowEdit', {
items: _.sortBy(menus, 'name'),
selected: node.getMetadata('id') || ''
popup_html = $(self.getTemplate({
name: 'callflowEdit',
data: {
items: _.sortBy(menus, 'name'),
selected: node.getMetadata('id') || ''
},
submodule: 'menu'
}));
if($('#menu_selector option:selected', popup_html).val() == undefined) {
if ($('#menu_selector option:selected', popup_html).val() === undefined) {
$('#edit_link', popup_html).hide();
}
$('.inline_action', popup_html).click(function(ev) {
var _data = ($(this).data('action') == 'edit') ?
{ id: $('#menu_selector', popup_html).val() } : {};
var _data = ($(this).data('action') === 'edit') ? { id: $('#menu_selector', popup_html).val() } : {};
ev.preventDefault();
@ -456,7 +459,7 @@ define(function(require){
title: self.i18n.active().callflows.menu.menu_title,
minHeight: '0',
beforeClose: function() {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -468,7 +471,9 @@ define(function(require){
resource: 'menu.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: {
paginate: false
}
},
success: function(data, status) {
callback && callback(data.data);
@ -487,7 +492,9 @@ define(function(require){
resource: 'menu.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: {
paginate: false
}
},
success: function(data) {
callback && callback(data.data);


src/apps/callflows/views/menu-callflowEdit.html → src/apps/callflows/submodules/menu/views/callflowEdit.html View File


src/apps/callflows/views/menu-callflowKey.html → src/apps/callflows/submodules/menu/views/callflowKey.html View File


src/apps/callflows/views/menu-edit.html → src/apps/callflows/submodules/menu/views/edit.html View File


+ 591
- 244
src/apps/callflows/submodules/misc/misc.js
File diff suppressed because it is too large
View File


+ 240
- 0
src/apps/callflows/submodules/misc/misc.scss View File

@ -0,0 +1,240 @@
/********** Two columns **********/
.callflows-port #two_columns {
padding-bottom: 20px;
}
.callflows-port #two_columns .wrapper {
clear: left;
width: 520px;
padding: 10px;
}
.callflows-port #two_columns .wrapper_form {
margin-top: 20px;
margin-left: 40px;
}
.callflows-port #two_columns .wrapper .column {
width: 220px;
padding: 6px 0px 5px;
background: #444;
border-radius: 6px;
}
.callflows-port #two_columns .wrapper .column.right {
float: right;
margin-left: 10px;
}
.callflows-port #two_columns .wrapper .column.left {
float: left;
margin-right: 10px;
}
.callflows-port #two_columns .wrapper .title_column {
background-color: #AFAFAF;
height: 28px;
line-height: 28px;
font-weight: bold;
font-size: 14px;
text-align: center;
margin-bottom: 3px;
}
.callflows-port #two_columns .wrapper .left ul.connect {
background-color: #444444;
height: 289px;
width: 220px;
overflow: auto;
float: left;
}
.callflows-port #two_columns .wrapper .connect {
min-height: 289px;
}
.callflows-port #two_columns .wrapper .right ul.connect {
background-color: #444444;
height: 289px;
width: 220px;
overflow: auto;
}
.callflows-port #two_columns .wrapper li {
list-style-type: none;
background-color: #AFAFAF;
color: #444;
display: block;
height: 28px;
line-height: 28px;
list-style-type: none;
overflow: hidden;
position: relative;
cursor: default;
}
.callflows-port #two_columns .wrapper li:not(:first-child) {
border-top: 1px solid #444;
}
.callflows-port #two_columns .item_name {
float:left;
overflow: hidden;
height: 28px;
line-height: 28px;
width: 155px;
font-size: 12px;
white-space: nowrap;
}
.callflows-port #two_columns .item_name.right {
width: 120px;
}
.callflows-port #two_columns .wrapper li:hover {
background-color: #cccccc;
}
.callflows-port #two_columns .wrapper li a.drag_btn {
float: left;
height: 28px;
width: 7px;
margin-right: 5px;
margin-left: 1px;
}
/* Ring group specific css */
.callflows-port #two_columns .options {
float: right;
margin-right: 2px;
padding-left: 4px;
border-left: 1px solid #444444;
height: 28px;
}
.callflows-port #two_columns .options .option {
width: 30px;
font-size: 12px;
margin-top: 2px;
height: 20px;
}
.callflows-port #two_columns .ring_group_form_wrapper {
display: block;
margin: auto;
width: 260px;
}
.callflows-port #two_columns .form_field_div {
width: 260px;
}
.callflows-port #two_columns .button_field_div {
margin: 20px 0px 5px;
text-align: center;
}
/********** Listpanel's search box **********/
.callflows-port .search_box {
height: 28px;
background-color:#444444;
padding-top: 7px;
border-bottom: 1px solid #222;
}
.callflows-port .search_box .searchsubmit1 {
float: left;
height: 20px;
width: 23px;
}
.callflows-port .search_box .searchsubmit2 {
float: left;
height: 20px;
width: 26px;
}
.callflows-port .search_box .searchfield {
border: medium none;
float: left;
height: 14px;
width: 130px;
border-radius: 0px;
box-shadow: none;
}
.callflows-port .search_box .searchfield:focus {
border: none;
border-color: transparent;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/********** Receive Fax **********/
.callflows-port#fax_callflow_popup #t_38_checkbox {
margin-top: 8px;
}
/* Missed call alert */
#missed_call_alert_popup {
width: 540px;
}
#missed_call_alert_popup .buttons-center {
margin-top: 10px;
}
#missed_call_alert_popup form {
margin-bottom: 0;
margin-top: 20px;
}
/* Set CAV */
#set_cav_alert_popup .cav-add-row .svg-icon {
cursor: pointer;
}
#set_cav_alert_popup .cav-remove-row {
margin-top: -10px;
cursor: pointer;
display: inline;
visibility: hidden;
}
#set_cav_alert_popup .cav-remove-row:hover {
color: #ff0000;
}
#set_cav_alert_popup .cav-list tr:hover .cav-remove-row {
visibility: visible;
}
/* Collect DTMF Popup */
.dialog_popup.collect-dtmf-popup .form_content .popup_field {
padding-bottom: 0;
}
/************ Webhooks *************/
.callflows-port#webhook_popup {
max-width: 450px;
.custom-data {
label[for="custom_data"] {
display: block;
text-align: center;
width: 100%;
}
.custom-data-container {
clear: both;
.data-key {
flex: initial;
width: 140px;
}
}
}
.monster-invalid {
float: none;
}
}

src/apps/callflows/views/callflow-edit_dialog.html → src/apps/callflows/submodules/misc/views/callflow-edit_dialog.html View File


src/apps/callflows/views/fax-callflowEdit.html → src/apps/callflows/submodules/misc/views/callflowEdit.html View File


src/apps/callflows/views/check_cid-callflowEdit.html → src/apps/callflows/submodules/misc/views/check_cid-callflowEdit.html View File


src/apps/callflows/views/check_cid-childCallflow.html → src/apps/callflows/submodules/misc/views/check_cid-childCallflow.html View File


src/apps/callflows/views/misc-collect-dtmf.html → src/apps/callflows/submodules/misc/views/collect-dtmf.html View File


src/apps/callflows/views/misc-disa.html → src/apps/callflows/submodules/misc/views/disa.html View File


+ 32
- 0
src/apps/callflows/submodules/misc/views/fax-callflowEdit.html View File

@ -0,0 +1,32 @@
<div class="dialog_popup fax_callflow_popup callflows-port">
<h1>{{ i18n.oldCallflows.sends_fax_to_user }}</h1>
<form name="form" method="post" action="#">
<div class="form_content">
<div class="popup_field">
<label for="user_selector">{{ i18n.oldCallflows.which_user }}</label>
<div class="select_wrapper">
<select id="user_selector">
{{#select objects.selected}}
{{#each objects.items}}
<option value="{{id}}">{{name}}</option>
{{/each}}
{{/select}}
</select>
<div class="action_links_div">
<div id="edit_link"><a class="inline_action" data-action="edit" href="#">{{ i18n.oldCallflows.edit_user_options }}</a></div>
<div><a class="inline_action" data-action="create" href="#">{{ i18n.oldCallflows.add_a_user }}</a></div>
</div>
</div>
<div class="clear"/>
</div>
<div class="popup_field checkbox_field">
<label for="t_38_checkbox">{{ i18n.oldCallflows.t_38_checkbox }}</label>
<input id="t_38_checkbox" type="checkbox"{{#compare objects.t_38 '===' true}} checked{{/compare}}>
<div class="clear"/>
</div>
</div>
</form>
<div class="buttons-center">
<button id="add" class="monster-button monster-button-primary">{{i18n.save}}</button>
</div>
</div>

src/apps/callflows/views/misc-group_pickup.html → src/apps/callflows/submodules/misc/views/group_pickup.html View File


src/apps/callflows/views/misc-language.html → src/apps/callflows/submodules/misc/views/language.html View File


src/apps/callflows/views/misc-missedCallAlert-dialog.html → src/apps/callflows/submodules/misc/views/missedCallAlert-dialog.html View File


src/apps/callflows/views/misc-pivot.html → src/apps/callflows/submodules/misc/views/pivot.html View File


src/apps/callflows/views/misc-prepend_cid_callflow.html → src/apps/callflows/submodules/misc/views/prepend_cid_callflow.html View File


src/apps/callflows/views/presence-callflowEdit.html → src/apps/callflows/submodules/misc/views/presence-callflowEdit.html View File


src/apps/callflows/views/recordCall-callflowEdit.html → src/apps/callflows/submodules/misc/views/recordCall-callflowEdit.html View File


src/apps/callflows/views/misc-response.html → src/apps/callflows/submodules/misc/views/response.html View File


+ 13
- 0
src/apps/callflows/submodules/misc/views/setAlertEdit.html View File

@ -0,0 +1,13 @@
<div class="dialog_popup callflows-port">
<form name="form" method="post" action="#">
<div class="form_content">
<div class="popup_field">
<label for="alert_info">{{ i18n.callflows.setAlertInfo.label }}: </label>
<input type="text" name="alert_info" id="alert_info" value="{{alert_info}}"/>
</div>
</div>
</form>
<div class="buttons-center">
<button id="add" class="monster-button monster-button-primary">{{ i18n.save }}</button>
</div>
</div>

+ 26
- 0
src/apps/callflows/submodules/misc/views/setcav-dialog.html View File

@ -0,0 +1,26 @@
<div id="set_cav_alert_popup" class="dialog_popup set-cav-alert callflows-port">
{{#monsterText}}
{{ i18n.callflows.setCav.help }}
{{/monsterText}}
<form name="form" method="post" action="#" id="set_cav_form">
<table class="cav-list">
<thead>
<tr>
<th>{{i18n.callflows.setCav.key}}</th>
<th>{{i18n.callflows.setCav.value}}</th>
<th width="5"></th>
</tr>
</thead>
<tbody></tbody>
</table>
<div class="cav-add-row">
{{telicon "plus--circle-o"}}
</div>
</form>
<div class="items-selector-wrapper"></div>
<div class="buttons-center">
<button class="monster-button monster-button-primary" id="save_cav_variables">{{ i18n.save }}</button>
</div>
</div>

+ 9
- 0
src/apps/callflows/submodules/misc/views/setcav-row.html View File

@ -0,0 +1,9 @@
<tr>
<td>
<input type="text" class="cav-key cav-input" value="{{key}}" name="items[{{index}}].key">
</td>
<td>
<input type="text" class="cav-value cav-input" value="{{value}}" name="items[{{index}}].value">
</td>
<td>{{telicon "minus--circle-o" class="cav-remove-row"}}</td>
</tr>

src/apps/callflows/views/misc-sleep.html → src/apps/callflows/submodules/misc/views/sleep.html View File


src/apps/callflows/views/misc-tts.html → src/apps/callflows/submodules/misc/views/tts.html View File


+ 66
- 0
src/apps/callflows/submodules/misc/views/webhook-callflowEdit.html View File

@ -0,0 +1,66 @@
<div id="webhook_popup" class="dialog_popup callflows-port">
{{#monsterText}}
{{ i18n.callflows.webhook.help }}
{{/monsterText}}
<form id="webhook_form" method="post" action="#">
<div class="form_content">
<div class="popup_field">
<label for="uri">
<i class="help-popover fa fa-question" data-toggle="tooltip" data-placement="right" data-original-title="{{ i18n.callflows.webhook.uri.help }}"></i>
{{ i18n.callflows.webhook.uri.label }}
</label>
<input type="text" id="uri" name="uri" value="{{uri}}"/>
</div>
<div class="popup_field">
<label for="http_verb">
<i class="help-popover fa fa-question" data-toggle="tooltip" data-placement="right" data-original-title="{{ i18n.callflows.webhook.httpVerb.help }}"></i>
{{ i18n.callflows.webhook.httpVerb.label }}
</label>
<select id="http_verb" name="http_verb">
{{#select http_verb}}
{{#each httpVerbsList}}
<option value="{{ @key }}">{{ this }}</option>
{{/each}}
{{/select}}
</select>
</div>
<div class="popup_field" id="form_popup_field"{{#unless hasVerbWithFormat}} style="display: none;"{{/unless}}>
<label for="format">
<i class="help-popover fa fa-question" data-toggle="tooltip" data-placement="right" data-original-title="{{ i18n.callflows.webhook.format.help }}"></i>
{{ i18n.callflows.webhook.format.label }}
</label>
<select id="format" name="format">
{{#select format}}
{{#each bodyFormatList}}
<option value="{{value}}">{{label}}</option>
{{/each}}
{{/select}}
</select>
</div>
<div class="popup_field">
<label for="retries">
<i class="help-popover fa fa-question" data-toggle="tooltip" data-placement="right" data-original-title="{{ i18n.callflows.webhook.retries.help }}"></i>
{{ i18n.callflows.webhook.retries.label }}
</label>
<select id="retries" name="retries">
{{#select retries}}
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
{{/select}}
</select>
</div>
<div class="popup_field custom-data">
<label for="custom_data">
<i class="help-popover fa fa-question" data-toggle="tooltip" data-placement="right" data-original-title="{{ i18n.callflows.webhook.customData.help }}"></i>
{{ i18n.callflows.webhook.customData.label }}
</label>
<div class="custom-data-container"></div>
</div>
</div>
</form>
<div class="buttons-center">
<button id="add" class="monster-button monster-button-primary">{{i18n.save}}</button>
</div>
</div>

+ 7
- 3
src/apps/callflows/submodules/qubicle/qubicle.js View File

@ -44,9 +44,13 @@ define(function(require) {
},
edit: function(node, callback) {
self.qubicleList(function(data) {
var popup_html = $(monster.template(self, 'qubicle-callflowEdit', {
items: _.sortBy(data, 'name'),
selected: node.getMetadata('id') || ''
var popup_html = $(self.getTemplate({
name: 'callflowEdit',
data: {
items: _.sortBy(data, 'name'),
selected: node.getMetadata('id') || ''
},
submodule: 'qubicle'
})),
popup;


src/apps/callflows/views/qubicle-callflowEdit.html → src/apps/callflows/submodules/qubicle/views/callflowEdit.html View File


+ 15
- 11
src/apps/callflows/submodules/resource/resource.js View File

@ -1,4 +1,4 @@
define(function(require){
define(function(require) {
var $ = require('jquery'),
_ = require('lodash'),
monster = require('monster');
@ -30,11 +30,11 @@ define(function(require){
],
isUsable: 'true',
weight: 140,
caption: function(node, caption_map) {
caption: function(node) {
return '';
},
edit: function(node, callback) {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -54,22 +54,26 @@ define(function(require){
],
isUsable: 'true',
weight: 150,
caption: function(node, caption_map) {
caption: function(node) {
return '';
},
edit: function(node, callback) {
var popup, popup_html;
popup_html = $(monster.template(self, 'resource-account_carrier', {
data_resource: {
'hunt_account_id': node.getMetadata('hunt_account_id') || '',
}
popup_html = $(self.getTemplate({
name: 'account_carrier',
data: {
data_resource: {
'hunt_account_id': node.getMetadata('hunt_account_id') || ''
}
},
submodule: 'resource'
}));
$('#add', popup_html).click(function() {
var hunt_id = $('#hunt_account_id', popup_html).val();
if(hunt_id) {
if (hunt_id) {
node.setMetadata('hunt_account_id', hunt_id);
}
@ -79,8 +83,8 @@ define(function(require){
popup = monster.ui.dialog(popup_html, {
title: self.i18n.active().callflows.resource.account_carrier_title,
beforeClose: function() {
if(typeof callback == 'function') {
callback();
if (typeof callback === 'function') {
callback();
}
}
});


src/apps/callflows/views/resource-account_carrier.html → src/apps/callflows/submodules/resource/views/account_carrier.html View File


+ 1
- 0
src/apps/callflows/submodules/temporalset/temporalset.css View File

@ -1,5 +1,6 @@
.callflows-port #temporalset-form .items-selector-wrapper {
width: 535px;
margin-left: 99px;
}
.callflows-port .warning-no-save {


+ 12
- 4
src/apps/callflows/submodules/temporalset/temporalset.js View File

@ -1,4 +1,4 @@
define(function(require){
define(function(require) {
var $ = require('jquery'),
_ = require('lodash'),
monster = require('monster');
@ -168,7 +168,11 @@ define(function(require){
temporalsetRender: function(data, target, callbacks) {
var self = this,
temporalset_html = $(monster.template(self, 'temporalset-callflowEdit', data)),
temporalset_html = $(self.getTemplate({
name: 'callflowEdit',
data: data,
submodule: 'temporalset'
})),
temporalsetForm = temporalset_html.find('#temporalset-form'),
widgetRules = self.temporalSetFormatRules(data);
@ -280,7 +284,9 @@ define(function(require){
resource: 'temporalRule.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: {
paginate: false
}
},
success: function(data) {
callback && callback(data.data);
@ -295,7 +301,9 @@ define(function(require){
resource: 'temporalSet.list',
data: {
accountId: self.accountId,
filters: { paginate:false }
filters: {
paginate: false
}
},
success: function(data) {
callback && callback(data.data);


src/apps/callflows/views/temporalset-callflowEdit.html → src/apps/callflows/submodules/temporalset/views/callflowEdit.html View File


+ 1
- 2
src/apps/callflows/submodules/timeofday/timeofday.css View File

@ -47,7 +47,6 @@
position: absolute;
}
.callflows-port #timeofday-form .time-wrapper-field .time-wrapper {
width: 233px;
padding: 0;
@ -74,4 +73,4 @@
.callflows-port #timeofday-form .timepicker {
width: 80px;
margin: 0 10px;
}
}

+ 199
- 173
src/apps/callflows/submodules/timeofday/timeofday.js View File

@ -1,4 +1,4 @@
define(function(require){
define(function(require) {
var $ = require('jquery'),
_ = require('lodash'),
monster = require('monster'),
@ -16,12 +16,11 @@ define(function(require){
var self = this,
normalized_data = self.timeofdayNormalizeData($.extend(true, {}, data.data, form_data));
if(typeof data.data == 'object' && data.data.id) {
if (typeof data.data === 'object' && data.data.id) {
self.temporalRuleUpdate(normalized_data, function(_data, status) {
success && success(_data, status, 'update');
});
}
else {
} else {
self.temporalRuleCreate(normalized_data, function(_data, status) {
success & success(_data, status, 'create');
});
@ -42,14 +41,14 @@ define(function(require){
save_success: function(_data) {
popup.dialog('close');
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback(_data);
}
},
delete_success: function() {
popup.dialog('close');
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback({ data: {} });
}
},
@ -70,7 +69,7 @@ define(function(require){
timeofdayEdit: function(data, _parent, _target, _callbacks, data_defaults) {
var self = this,
parent = _parent || $('#timeofday-content'),
target = _target || $('#timeofday-view', parent)
target = _target || $('#timeofday-view', parent),
_callbacks = _callbacks || {},
callbacks = {
save_success: _callbacks.save_success,
@ -127,8 +126,8 @@ define(function(require){
cycle: [
{ id: 'weekly', value: 'Weekly' },
{ id: 'monthly', value:'Monthly' },
{ id: 'yearly', value:'Yearly' }
{ id: 'monthly', value: 'Monthly' },
{ id: 'yearly', value: 'Yearly' }
],
ordinals: [
@ -160,7 +159,7 @@ define(function(require){
}
};
if(typeof data == 'object' && data.id) {
if (typeof data === 'object' && data.id) {
self.temporalRuleGet(data.id, function(_data, status) {
var oldFormatData = { data: _data };
@ -179,20 +178,23 @@ define(function(require){
callbacks.after_render();
}
});
}
else {
} else {
self.timeofdayRender(defaults, target, callbacks);
if(typeof callbacks.after_render == 'function') {
if (typeof callbacks.after_render === 'function') {
callbacks.after_render();
}
}
},
timeofdayRender: function(data, target, callbacks){
timeofdayRender: function(data, target, callbacks) {
var self = this,
wday,
timeofday_html = $(monster.template(self, 'timeofday-callflowEdit', data)),
timeofday_html = $(self.getTemplate({
name: 'callflowEdit',
data: data,
submodule: 'timeofday'
})),
selectedWdays = data.data.wdays.length,
_after_render,
timeofdayForm = timeofday_html.find('#timeofday-form');
@ -230,38 +232,47 @@ define(function(require){
$('#weekdays', timeofday_html).hide();
$('#specific_day', timeofday_html).hide();
if(data.data.id == undefined) {
if (data.data.id === undefined) {
$('#weekly_every', timeofday_html).show();
$('#days_checkboxes', timeofday_html).show();
} else {
if(data.data.cycle == 'monthly') {
if (data.data.cycle === 'monthly') {
$('#monthly_every', timeofday_html).show();
$('#ordinal', timeofday_html).show();
if(data.data.days != undefined && data.data.days[0] != undefined) {
if (data.data.days !== undefined && data.data.days[0] !== undefined) {
$('#specific_day', timeofday_html).show();
} else {
$('#weekdays', timeofday_html).show();
}
} else if(data.data.cycle == 'yearly') {
} else if (data.data.cycle === 'yearly') {
$('#yearly_every', timeofday_html).show();
$('#ordinal', timeofday_html).show();
if(data.data.days != undefined && data.data.days[0] != undefined) {
if (data.data.days !== undefined && data.data.days[0] !== undefined) {
$('#specific_day', timeofday_html).show();
} else {
$('#weekdays', timeofday_html).show();
}
} else if(data.data.cycle = 'weekly') {
} else if (data.data.cycle === 'weekly') {
$('#weekly_every', timeofday_html).show();
$('#days_checkboxes', timeofday_html).show();
}
}
$('.fake_checkbox', timeofday_html).click(function() {
var $this = $(this),
toCheck = !$this.hasClass('checked');
$(this).toggleClass('checked');
if (toCheck) {
selectedWdays += 1;
} else {
selectedWdays -= 1;
}
});
$('#ordinal', timeofday_html).change(function() {
if($(this).val() == 'every') {
if ($(this).val() === 'every') {
$('#weekdays', timeofday_html).hide();
$('#specific_day', timeofday_html).show();
} else {
@ -271,6 +282,8 @@ define(function(require){
});
$('#cycle', timeofday_html).change(function() {
var $this = $(this);
$('#yearly_every', timeofday_html).hide();
$('#monthly_every', timeofday_html).hide();
$('#weekly_every', timeofday_html).hide();
@ -279,35 +292,29 @@ define(function(require){
$('#weekdays', timeofday_html).hide();
$('#specific_day', timeofday_html).hide();
switch($(this).val()) {
case 'yearly':
$('#yearly_every', timeofday_html).show();
$('#ordinal', timeofday_html).show();
if($('#ordinal', timeofday_html).val() == 'every') {
//$('#weekdays', timeofday_html).hide();
$('#specific_day', timeofday_html).show();
} else {
$('#weekdays', timeofday_html).show();
//$('#specific_day', timeofday_html).hide();
}
break;
case 'monthly':
$('#monthly_every', timeofday_html).show();
$('#ordinal', timeofday_html).show();
if($('#ordinal', timeofday_html).val() == 'every') {
//$('#weekdays', timeofday_html).hide();
$('#specific_day', timeofday_html).show();
} else {
$('#weekdays', timeofday_html).show();
//$('#specific_day', timeofday_html).hide();
}
break;
case 'weekly':
$('#weekly_every', timeofday_html).show();
$('#days_checkboxes', timeofday_html).show();
break;
if ($this.val() === 'yearly') {
$('#yearly_every', timeofday_html).show();
$('#ordinal', timeofday_html).show();
if ($('#ordinal', timeofday_html).val() === 'every') {
//$('#weekdays', timeofday_html).hide();
$('#specific_day', timeofday_html).show();
} else {
$('#weekdays', timeofday_html).show();
//$('#specific_day', timeofday_html).hide();
}
} else if ($this.val() === 'monthly') {
$('#monthly_every', timeofday_html).show();
$('#ordinal', timeofday_html).show();
if ($('#ordinal', timeofday_html).val() === 'every') {
//$('#weekdays', timeofday_html).hide();
$('#specific_day', timeofday_html).show();
} else {
$('#weekdays', timeofday_html).show();
//$('#specific_day', timeofday_html).hide();
}
} else if ($this.val() === 'weekly') {
$('#weekly_every', timeofday_html).show();
$('#days_checkboxes', timeofday_html).show();
}
});
@ -316,10 +323,15 @@ define(function(require){
var $this = $(this);
if(!$this.hasClass('disabled')) {
$this.addClass('disabled');
if (!$this.hasClass('disabled')) {
if ($('#cycle', timeofday_html).val() === 'weekly' && selectedWdays === 0) {
monster.ui.toast({
type: 'warning',
message: self.i18n.active().callflows.timeofday.toastr.warning.missingDay
});
} else if (monster.ui.valid(timeofdayForm)) {
$this.addClass('disabled');
if(monster.ui.valid(timeofdayForm)) {
var form_data = monster.ui.getFormData('timeofday-form');
form_data.wdays = [];
@ -329,13 +341,12 @@ define(function(require){
form_data.wdays.push($(this).data('value'));
});
form_data.interval = $('#cycle', timeofday_html).val() == 'monthly' ? $('#interval_month', timeofday_html).val() : $('#interval_week', timeofday_html).val();
form_data.interval = $('#cycle', timeofday_html).val() === 'monthly' ? $('#interval_month', timeofday_html).val() : $('#interval_week', timeofday_html).val();
form_data.start_date = timeofday_html.find('#start_date').datepicker('getDate');
form_data = self.timeofdayCleanFormData(form_data);
self.timeofdaySave(form_data, data, callbacks.save_success);
}
else {
} else {
$this.removeClass('disabled');
monster.ui.alert('error', self.i18n.active().callflows.timeofday.there_were_errors_on_the_form);
}
@ -360,7 +371,7 @@ define(function(require){
_after_render = callbacks.after_render;
callbacks.after_render = function() {
if(typeof _after_render == 'function') {
if (typeof _after_render === 'function') {
_after_render();
}
};
@ -375,37 +386,36 @@ define(function(require){
timeStart = form_data.extra.allDay ? '0:00' : form_data.extra.timeofday.from,
timeEnd = form_data.extra.allDay ? '24:00' : form_data.extra.timeofday.to;
if(form_data.cycle != 'weekly' && form_data.weekday != undefined) {
if (form_data.cycle !== 'weekly' && form_data.weekday !== undefined) {
form_data.wdays = [];
form_data.wdays.push(form_data.weekday);
}
$.each(form_data.wdays, function(i, val) {
if(val) {
if(val == 'wednesday') {
if (val) {
if (val === 'wednesday') {
val = 'wensday';
}
wdays.push(val);
}
});
if(wdays.length > 0 && wdays[0] == 'sunday') {
if (wdays.length > 0 && wdays[0] === 'sunday') {
wdays.push(wdays.shift());
}
form_data.wdays = wdays;
if(form_data.start_date === '') {
if (form_data.start_date === '') {
delete form_data.start_date;
}
else {
} else {
form_data.start_date = monster.util.dateToGregorian(form_data.start_date);
}
form_data.time_window_start = parseInt(monster.util.timeToSeconds(timeStart));
form_data.time_window_stop = parseInt(monster.util.timeToSeconds(timeEnd));
if(form_data.month) {
if (form_data.month) {
form_data.month = parseInt(form_data.month);
}
@ -415,22 +425,21 @@ define(function(require){
},
timeofdayNormalizeData: function(form_data) {
if(form_data.cycle == 'weekly') {
if (form_data.cycle === 'weekly') {
delete form_data.ordinal;
delete form_data.days;
delete form_data.month;
}
else {
form_data.cycle == 'yearly' ? delete form_data.interval : delete form_data.month;
form_data.ordinal != 'every' ? delete form_data.days : delete form_data.wdays;
} else {
form_data.cycle === 'yearly' ? delete form_data.interval : delete form_data.month;
form_data.ordinal !== 'every' ? delete form_data.days : delete form_data.wdays;
}
delete form_data.time;
delete form_data.weekday;
if(form_data.enabled === "true") {
if (form_data.enabled === 'true') {
form_data.enabled = true;
} else if(form_data.enabled === "false") {
} else if (form_data.enabled === 'false') {
form_data.enabled = false;
} else {
delete form_data.enabled;
@ -469,10 +478,10 @@ define(function(require){
data.data.showSave = true;
data.data.showDelete = data.data.id ? true : false;
if(data.data.hasOwnProperty('ui_metadata') && data.data.ui_metadata.hasOwnProperty('origin') && data.data.ui_metadata.origin === 'voip') {
if (data.data.hasOwnProperty('ui_metadata') && data.data.ui_metadata.hasOwnProperty('origin') && data.data.ui_metadata.origin === 'voip') {
data.data.showSave = false;
if(!monster.util.isSuperDuper()) {
if (!monster.util.isSuperDuper()) {
data.data.showDelete = false;
}
}
@ -482,8 +491,8 @@ define(function(require){
timeofdayMigrateData: function(data) {
// Check for spelling ;)
if('wdays' in data.data && (wday = $.inArray('wensday', data.data.wdays)) > -1) {
data.data.wdays[wday] = 'wednesday';
if ('wdays' in data.data && $.inArray('wensday', data.data.wdays) > -1) {
data.data.wdays[data.data.wdays.indexOf('wensday')] = 'wednesday';
}
return data;
@ -530,9 +539,13 @@ define(function(require){
var popup, popup_html;
popup_html = $(monster.template(self, 'timeofday-callflowKey', {
items: formattedData,
selected: child_node.key
popup_html = $(self.getTemplate({
name: 'callflowKey',
data: {
items: formattedData,
selected: child_node.key
},
submodule: 'timeofday'
}));
$('.inline_action', popup_html).click(function(ev) {
@ -586,9 +599,13 @@ define(function(require){
edit: function(node, callback) {
var popup, popup_html;
popup_html = $(monster.template(self, 'timeofday-callflowTimezone', {
items: {},
selected: {}
popup_html = $(self.getTemplate({
name: 'callflowTimezone',
data: {
items: {},
selected: {}
},
submodule: 'timeofday'
}));
timezone.populateDropdown($('#timezone_selector', popup_html), node.getMetadata('timezone') || 'inherit', {inherit: self.i18n.active().defaultTimezone});
@ -637,40 +654,42 @@ define(function(require){
],
isUsable: 'true',
weight: 20,
caption: function(node, caption_map) {
caption: function(node) {
return '';
},
edit: function(node, callback) {
self.temporalRuleList(function(listRules) {
var popup,
popup_html,
rules,
rules = node.getMetadata('rules'),
unselected_rules = [],
selected_rules = [];
if(rules = node.getMetadata('rules')) {
if (rules) {
$.each(listRules, function(i, obj) {
if($.inArray(obj.id, rules) != -1) {
if ($.inArray(obj.id, rules) !== -1) {
selected_rules.push(obj);
}
else {
} else {
unselected_rules.push(obj);
}
});
}
else {
} else {
unselected_rules = listRules;
}
popup_html = $(monster.template(self, 'timeofday-two_column', {
left: {
title: self.i18n.active().callflows.timeofday.unselected_time_of_day_rules,
items: unselected_rules
popup_html = $(self.getTemplate({
name: 'two_column',
data: {
left: {
title: self.i18n.active().callflows.timeofday.unselected_time_of_day_rules,
items: unselected_rules
},
right: {
title: self.i18n.active().callflows.timeofday.selected_time_of_day_rules,
items: selected_rules
}
},
right: {
title: self.i18n.active().callflows.timeofday.selected_time_of_day_rules,
items: selected_rules
}
submodule: 'timeofday'
}));
$('#add', popup_html).click(function() {
@ -688,7 +707,7 @@ define(function(require){
popup = monster.ui.dialog(popup_html, {
title: self.i18n.active().callflows.timeofday.disable_time_of_day_rules_title,
beforeClose: function() {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -732,38 +751,42 @@ define(function(require){
],
isUsable: 'true',
weight: 30,
caption: function(node, caption_map) {
caption: function(node) {
return '';
},
edit: function(node, callback) {
self.temporalRuleList(function(listRules) {
var popup, popup_html, rules,
unselected_rules = [],
selected_rules = [];
var popup,
popup_html,
rules = node.getMetadata('rules'),
unselected_rules = [],
selected_rules = [];
if(rules = node.getMetadata('rules')) {
if (rules) {
$.each(listRules, function(i, obj) {
if($.inArray(obj.id, rules) != -1) {
if ($.inArray(obj.id, rules) !== -1) {
selected_rules.push(obj);
}
else {
} else {
unselected_rules.push(obj);
}
});
}
else {
} else {
unselected_rules = listRules;
}
popup_html = $(monster.template(self, 'timeofday-two_column', {
left: {
title: self.i18n.active().callflows.timeofday.unselected_time_of_day_rules,
items: unselected_rules
popup_html = $(self.getTemplate({
name: 'two_column',
data: {
left: {
title: self.i18n.active().callflows.timeofday.unselected_time_of_day_rules,
items: unselected_rules
},
right: {
title: self.i18n.active().callflows.timeofday.selected_time_of_day_rules,
items: selected_rules
}
},
right: {
title: self.i18n.active().callflows.timeofday.selected_time_of_day_rules,
items: selected_rules
}
submodule: 'timeofday'
}));
$('#add', popup_html).click(function() {
@ -781,7 +804,7 @@ define(function(require){
popup = monster.ui.dialog(popup_html, {
title: self.i18n.active().callflows.timeofday.enable_time_of_day_rules,
beforeClose: function() {
if(typeof callback == 'function') {
if (typeof callback === 'function') {
callback();
}
}
@ -825,30 +848,32 @@ define(function(require){
],
isUsable: 'true',
weight: 40,
caption: function(node, caption_map) {
caption: function(node) {
return '';
},
edit: function(node, callback) {
self.temporalRuleList(function(listRules) {
var popup, popup_html, rules,
unselected_rules = [],
selected_rules = [];
if(rules = node.getMetadata('rules')) {
$.each(listRules, function(i, obj) {
if($.inArray(obj.id, rules) != -1) {
selected_rules.push(obj);
}
else {
unselected_rules.push(obj);
}
});
}
else {
unselected_rules = listRules;
}
var popup,
popup_html,
rules = node.getMetadata('rules'),
unselected_rules = [],
selected_rules = [];
popup_html = $(monster.template(self, 'timeofday-two_column', {
if (rules) {
$.each(listRules, function(i, obj) {
if ($.inArray(obj.id, rules) !== -1) {
selected_rules.push(obj);
} else {
unselected_rules.push(obj);
}
});
} else {
unselected_rules = listRules;
}
popup_html = $(self.getTemplate({
name: 'two_column',
data: {
left: {
title: self.i18n.active().callflows.timeofday.unselected_time_of_day_rules,
items: unselected_rules
@ -857,49 +882,50 @@ define(function(require){
title: self.i18n.active().callflows.timeofday.selected_time_of_day_rules,
items: selected_rules
}
}));
},
submodule: 'timeofday'
}));
$('#add', popup_html).click(function() {
var _rules = [];
$('#add', popup_html).click(function() {
var _rules = [];
$('.right .connect li', popup_html).each(function() {
_rules.push($(this).data('id'));
});
$('.right .connect li', popup_html).each(function() {
_rules.push($(this).data('id'));
});
node.setMetadata('rules', _rules);
node.setMetadata('rules', _rules);
popup.dialog('close');
});
popup.dialog('close');
});
popup = monster.ui.dialog(popup_html, {
title: self.i18n.active().callflows.timeofday.reset_time_of_day_rules,
beforeClose: function() {
if(typeof callback == 'function') {
callback();
}
popup = monster.ui.dialog(popup_html, {
title: self.i18n.active().callflows.timeofday.reset_time_of_day_rules,
beforeClose: function() {
if (typeof callback === 'function') {
callback();
}
});
}
});
/* Initialize the scrollpane AFTER it has rendered */
/* Initialize the scrollpane AFTER it has rendered */
//$('.scrollable', popup).jScrollPane();
//$('.scrollable', popup).jScrollPane();
$('.connect', popup).sortable({
connectWith: $('.connect', popup),
zIndex: 2000,
helper: 'clone',
appendTo: $('.wrapper', popup),
scroll: false,
tolerance: 'pointer',
receive: function() {
//$('.scrollable', popup).data('jsp').reinitialise();
},
remove: function() {
//$('.scrollable', popup).data('jsp').reinitialise();
}
});
}
);
$('.connect', popup).sortable({
connectWith: $('.connect', popup),
zIndex: 2000,
helper: 'clone',
appendTo: $('.wrapper', popup),
scroll: false,
tolerance: 'pointer',
receive: function() {
//$('.scrollable', popup).data('jsp').reinitialise();
},
remove: function() {
//$('.scrollable', popup).data('jsp').reinitialise();
}
});
});
}
}
});


src/apps/callflows/views/timeofday-callflowEdit.html → src/apps/callflows/submodules/timeofday/views/callflowEdit.html View File


src/apps/callflows/views/timeofday-callflowKey.html → src/apps/callflows/submodules/timeofday/views/callflowKey.html View File


src/apps/callflows/views/timeofday-callflowTimezone.html → src/apps/callflows/submodules/timeofday/views/callflowTimezone.html View File


src/apps/callflows/views/timeofday-two_column.html → src/apps/callflows/submodules/timeofday/views/two_column.html View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save