9
0
Fork 0

Initial osmocom release

This commit is contained in:
Alton MacDonald 2013-05-29 00:32:36 +02:00
commit 30cc17df6b
95 changed files with 37381 additions and 0 deletions

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
# compiled python code
*.pyc
# python egg directory generated after install
*.egg-info/
build/
dist/
# autogenerated files when run in this directory
*.pid
*.log

26
CHANGES.txt Normal file
View File

@ -0,0 +1,26 @@
0.4
---
- Changed project name to osmo-oohmi for incorporation into official osmocom repository
- Added Visual hint for indicating if BTS is Active or not
- Cleaned up redundant code
- Added more customization details to README
0.3
---
- Cleaned up folder structure
- Added IMEI & IMSI naming functionality
- Added functionality to BTS channel configuration settings
- Optimized Subscriber table view
- Added IP address to BTS detail view
0.2
---
- Migrated from sigle python file to scaffolding architecture
0.1
---
- Initial version

661
COPYING.txt Normal file
View File

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.

2
MANIFEST.in Normal file
View File

@ -0,0 +1,2 @@
include *.txt *.ini *.cfg *.rst
recursive-include hlr_mgmt *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.csv

64
README.txt Normal file
View File

@ -0,0 +1,64 @@
Features:
1) View BSC and SGSN Statistics
* View Channel and Data Usage
* See running versions
2) Administer Subscribers
* Authorize IMSIs dynamically
* Authorize IMSIs based on IMEI identification
* Name IMSI and IMEI for easily identification
3) Send SMS
* Send SMS to individual subscribers
* Broadcast SMS to attached subscribers (useful for notifying about system upgrade)
4) Administer BTS Settings
* View BTS IP address for easy debugging access
* Change physical channgel configuration for allocating Voice and Data channels as needed
5) Management Scripts
* In case of failure, the backend services can be restarted from the web interface.
Supported init.d scripts are:
* LCR
* Asterisk
* GSGN
* OpenBSC
* OsmoSGSN
6) Additional Scripts
* SubscriberMonitor: Welcome message to new or returning roaming subscribers
* RegisterIMEI: script for individually authorizing subscribers.
Its easier to have OpenBSC scan the network for the current IMEI-IMSI relationship and authorize a SIM card in a device than finding out the IMSI manually.
User only enters IMEI and the script does the rest
* both scripts are managed by hlr_mgmt module and can also be run individually from the command line
Installation & Configuration:
1) Customize the init file to suit your settings. Lines of particular interest are shown below:
hlr_mgmt/__init__.py
# OpenBSC Settings
settings['provider'] = '<<Provider Name>>'
settings['db'] = '/etc/openbsc/hlr.sqlite3'
settings['bsc_ip'] = "127.0.0.1"
settings['sgsn_ip'] = "127.0.0.1"
settings['bsc_port'] = 4242
settings['sgsn_port'] = 4245
OPTIONAL:
If you can produce custom SIM cards with your own MCC/MNC for use in your local network,
you can add your Provider Details at the end of hlr_mgmt/mcc_mnc.csv following the format:
MCC,MNC,Network,Operator,Status
2) Install the python dependencies
sudo python setup.py install
3) Run the Server:
pserve production.ini start
OPTIONAL:
pserve is a nice python daemonizing function, customize the execution of the hlr_mgmt module by changing runtime flags.
pserver --help
4) Access the Web Interface
http://localhost:8080/

87
development.ini Normal file
View File

@ -0,0 +1,87 @@
# -*- coding: utf-8 -*-
###
# Copyright (C) 2013
# Fraunhofer Institute for Open Communication Systems (FOKUS)
# Competence Center NETwork research (NET), St. Augustin, GERMANY
# Alton MacDonald <alton.kenneth.macdonald@fokus.fraunhofer.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
###
[app:main]
use = egg:osmo-oohmi
pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
pyramid.includes = pyramid_debugtoolbar
# By default, the toolbar only appears for clients from IP addresses
# '127.0.0.1' and '::1'.
# debugtoolbar.hosts = 127.0.0.1 ::1
###
# wsgi server configuration
###
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 8080
###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
###
[loggers]
keys = root, osmo_oohmi
[handlers]
keys = console, filelog
[formatters]
keys = generic
[logger_root]
level = DEBUG
handlers = console, filelog
[logger_osmo_oohmi]
level = DEBUG
handlers = filelog
qualname = osmo_oohmi
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[handler_filelog]
class = FileHandler
args = ('/var/log/osmo-oohmi.log','a')
level = DEBUG
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s

133
hlr_mgmt/RegisterIMEI.py Normal file
View File

@ -0,0 +1,133 @@
#!/usr/bin/python
###
# Copyright (C) 2013
# Fraunhofer Institute for Open Communication Systems (FOKUS)
# Competence Center NETwork research (NET), St. Augustin, GERMANY
# Alton MacDonald <alton.kenneth.macdonald@fokus.fraunhofer.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###
import sys, sqlite3, logging
import threading, time
import collections
#from datetime import datetime, timedelta
#from multiprocessing import Process
log = logging.getLogger(__name__)
class RegisterIMEI(threading.Thread):
## Initialization and Settings ##
def __init__(self, db=None, imei=None):
threading.Thread.__init__(self)
self.HLR_DB = db
self.imei = imei
## Luhn checksum functions courtesy of Wikipedia ##
def digits_of(self,n):
return [int(d) for d in str(n)]
def luhn_checksum(self,imei):
digits = self.digits_of(imei)
odd_digits = digits[-1::-2]
even_digits = digits[-2::-2]
checksum = 0
checksum += sum(odd_digits)
for d in even_digits:
checksum += sum(self.digits_of(d*2))
return checksum % 10
def calculate_luhn(self,imei_zero):
if not len(self.digits_of(imei_zero)) == 14:
if len(self.digits_of(imei_zero)) == 15:
imei_zero = imei_zero[:14]
else:
return -1
check_digit = self.luhn_checksum(int(imei_zero) * 10)
return check_digit if check_digit == 0 else 10 - check_digit
## Class Functions ##
def isvalid_imei(self,imei):
return self.luhn_checksum(imei) == 0
def get_imsi(self,imei):
sql_imei = (imei,)
# gets the imei-imsi mapping registered in the last hour
sql_string="select subscriber.imsi from equipment,equipmentwatch,subscriber where equipmentwatch.equipment_id=equipment.id and subscriber.id=equipmentwatch.subscriber_id and equipment.updated=equipmentwatch.updated and equipment.updated>=datetime('now','-1 hour') and imei=?"
self.cursor.execute(sql_string,sql_imei)
return self.cursor.fetchall()
def authorize_subscriber(self,imsi):
sql_imsi = (str(imsi[0]),)
sql_string="update subscriber set authorized=1 where imsi=?"
self.cursor.execute(sql_string,sql_imsi)
self.sqlconn.commit()
self.sqlconn.close()
def pre_checks(self):
if not len(self.digits_of(self.imei)) == 15:
log.debug("IMEI: " + self.imei + " has incorrect length")
return -1
if not self.isvalid_imei(self.imei):
log.debug("IMEI: " + self.imei + " has incorrect checksum digit")
return -2
return 0
def authorize_imei(self,imei):
precheck = self.pre_checks()
if precheck<0:
return precheck
#replaces checksum digit with zero to be consistent with how OpenBSC stores the IMEI values
#imei = imei/10*10
imei = imei[:-1] + '0'
imsi = self.get_imsi(imei)
# loop that guarantees we get the latest imei-imsi mapping to avoid accidentally registering a SIM card no longer present in the phone
tries = 1
while len(imsi)==0 and tries <= 60:
log.debug("IMEI: " + imei + " not found, trying again in 1 minute...")
time.sleep(60)
imsi = self.get_imsi(imei)
tries = tries + 1
if len(imsi)==0:
log.debug("waiting period over for IMEI: " + imei + "...")
return -3
else:
log.debug("Authorizing IMSI found in IMEI: " + imei)
self.authorize_subscriber(imsi[0])
return 0
def run(self):
log.debug("starting RegisterIMEI deamon")
self.sqlconn = sqlite3.connect(self.HLR_DB)
self.cursor = self.sqlconn.cursor()
return self.authorize_imei(self.imei)
def main():
if len(sys.argv)<3:
print "ERROR: not enough arguments\n"
print "USAGE: python " + sys.argv[0] + " /path/to/hlr_db.sqlite3 imei\n"
exit(1)
reg_imei = RegisterIMEI(sys.argv[1],sys.argv[2])
reg_imei.setDaemon(True)
reg_imei.start()
if __name__ == '__main__':
sys.exit(main())

View File

@ -0,0 +1,116 @@
#!/usr/bin/python
###
# Copyright (C) 2013
# Fraunhofer Institute for Open Communication Systems (FOKUS)
# Competence Center NETwork research (NET), St. Augustin, GERMANY
# Alton MacDonald <alton.kenneth.macdonald@fokus.fraunhofer.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###
import sys, sqlite3, logging
import threading, time
import collections
from datetime import datetime, timedelta
from telnet_backend import telnet_backend
log = logging.getLogger(__name__)
class SubscriberMonitor(threading.Thread):
## Initialization and Settings ##
def __init__(self, provider_name, db, ip="127.0.0.1", port=4242):
threading.Thread.__init__(self)
self.provider = provider_name
self.HLR_DB = db
self.bsc_conn = telnet_backend(ip, port)
self.active_subscribers = collections.defaultdict()
self.active = True
self.sqlconn = sqlite3.connect(self.HLR_DB, check_same_thread = False)
self.cursor = self.sqlconn.cursor()
def run(self):
self.get_active_subs()
while(self.active):
self.check_new_subs()
self.get_active_subs()
time.sleep(60)
def stop(self):
self.active = False
def restart(self):
self.active_subscribers = collections.defaultdict()
self.active = True
def is_running(self):
return self.active
def get_active_subs(self):
# query active subscribers
self.cursor.execute("select * from subscriber where authorized=1 and lac>0")
result = self.cursor.fetchall()
if len(result)>0:
for subscriber in result:
#implicitly adds and updates subscribers with their expire_lu parameter
self.active_subscribers[subscriber[5]]=subscriber[9]
def check_new_subs(self):
# authorized=1 checks for authorized subscribers
# updated>datetime(...) checks for updates in the last minute
# lac checks that the phone is active
# TODO: currently ASSUMED that one LAC is used, if two are used this condition might not always work, check later...
#sqlIndex = [0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ]
#sqlValue = (id, created, updated, imsi, name, extension, authorized, tmsi, lac, expire_lu)
# query updated subscriber entries
self.cursor.execute("select * from subscriber where authorized=1 and lac>0 and updated>datetime('now','-1 minute')")
result = self.cursor.fetchall()
self.bsc_conn.connect()
if len(result)>0 and self.bsc_conn.connected:
for subscriber in result:
if not self.active_subscribers.has_key(subscriber[5]):
# new subscriber
self.bsc_conn.send_welcome_sms(self.provider, subscriber[5])
else:
# workaround for excessive premature updates cause by expire_lu values
# expire_lu tells OpenBSC when to update our subscriber entries
# unfortunately it is set to 1 hour after after each update is made
# so we have to ignore sending sms messages each hour to our already subscribed users
updated = datetime.strptime(subscriber[2],"%Y-%m-%d %H:%M:%S")
expected = datetime.strptime(self.active_subscribers[subscriber[5]],"%Y-%m-%d %H:%M:%S")
diff = updated-expected
if diff > timedelta(hours=1):
# returning subscriber (roaming/out-of-range/?)
self.bsc_conn.send_welcome_sms(subscriber[5])
self.bsc_conn.close()
def main():
if len(sys.argv)<3:
print "ERROR: not enough arguments\n"
print "USAGE: python " + sys.argv[0] + " provider_name /path/to/hlr_db.sqlite3 [openbsc_ip] [openbsc_port]\n"
exit(1)
if len(sys.argv)==3:
subMonitor = SubscriberMonitor(sys.argv[1], sys.argv[2])
if len(sys.argv)==4:
subMonitor = SubscriberMonitor(sys.argv[1], sys.argv[2], ip=sys.argv[3])
if len(sys.argv)==5:
subMonitor = SubscriberMonitor(sys.argv[1], sys.argv[2], ip=sys.argv[3], port=sys.argv[4])
subMonitor.setDaemon(False)
subMonitor.start()
if __name__ == '__main__':
sys.exit(main())

138
hlr_mgmt/__init__.py Normal file
View File

@ -0,0 +1,138 @@
# -*- coding: utf-8 -*-
###
# Copyright (C) 2013
# Fraunhofer Institute for Open Communication Systems (FOKUS)
# Competence Center NETwork research (NET), St. Augustin, GERMANY
# Alton MacDonald <alton.kenneth.macdonald@fokus.fraunhofer.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###
import os, logging
import sqlite3
import collections, csv
from pyramid.config import Configurator
from pyramid.events import NewRequest
from pyramid.events import subscriber
from pyramid.events import ApplicationCreated
from pyramid.httpexceptions import HTTPFound
from pyramid.session import UnencryptedCookieSessionFactoryConfig
from pyramid.view import view_config
from SubscriberMonitor import SubscriberMonitor
log = logging.getLogger(__name__)
here = os.path.dirname(os.path.abspath(__file__))
## MC/MNC parsing ##
def parse_mcc_csv(csv_file):
log.debug('Parsing MCC MNC csv file...')
mcc_mnc = collections.defaultdict()
csv_obj = open(csv_file)
csv_reader = csv.reader(csv_obj, delimiter=',')
#country
#mcc, mnc, network, operator or brand name, status
for row in csv_reader:
if len(row)==1:
country=row[0]
else:
index = row[0]+row[1]
if len(row[3])>0:
mcc_mnc[index] = (country,row[3])
else:
mcc_mnc[index] = (country,row[2])
return mcc_mnc
def close_db_connection(request):
request.db.close()
# Application Subscribers ( Event Listeners )
@subscriber(NewRequest)
def new_request_subscriber(event):
request = event.request
#log.debug('Received HTTP Request from ' + request.environ['REMOTE_ADDR'] + " for URI: " + request.environ['PATH_INFO'])
settings = request.registry.settings
request.db = sqlite3.connect(settings['db'])
request.add_finished_callback(close_db_connection)
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
# configuration settings
settings = {}
settings['reload_all'] = True
settings['debug_all'] = True
settings['mako.directories'] = os.path.join(here, 'templates')
settings['mako.input_encoding'] = 'utf-8'
# OpenBSC Settings
settings['provider'] = '<<Provider Name>>'
settings['db'] = '/etc/openbsc/hlr.sqlite3'
settings['bsc_ip'] = "127.0.0.1"
settings['sgsn_ip'] = "127.0.0.1"
settings['bsc_port'] = 4242
settings['sgsn_port'] = 4245
# loads MCC MNC codes to memory
mcc_mnc = os.path.join(here,'mcc_mnc.csv')
settings['mcc_mnc'] = parse_mcc_csv(mcc_mnc)
# mcc_mnc was obtained manually from http://mobile-network-codes.com/mobile-network-codes-country-codes.asp
# initiates SubscriberMonitor
subMonitor = SubscriberMonitor(settings['provider'], settings['db'], port=settings['bsc_port'])
subMonitor.setDaemon(True)
subMonitor.start()
settings['subMonitor'] = subMonitor
# session factory
session_factory = UnencryptedCookieSessionFactoryConfig('0p3nb5c.5ign4tur3')
# configuration setup
config = Configurator(settings=settings, session_factory=session_factory)
config.include('pyramid_debugtoolbar')
config.include('pyramid_exclog')
# routes setup
config.add_route('www_root','/')
config.add_route('bsc', '/bsc/')
config.add_route('bts', '/bts/')
config.add_route('toggle_channel', '/bts/{bts_id}/{channel}/')
config.add_route('sgsn', '/sgsn/')
config.add_route('subscribers', '/subscribers/')
config.add_route('subscriber_detail','/subscribers/{extension}')
config.add_route('authorize_imei','/authorize/imei/{imei}')
config.add_route('authorize_toggle','/authorize/subscriber/{extension}')
config.add_route('rename_component','/rename/{field}/{reference}/{value}')
config.add_route('clear_component','/rename/{field}/{reference}/')
config.add_route('sms', '/sms/')
config.add_route('delete_sms','/sms/delete/{id}')
config.add_route('clear_sms','/sms/clear')
config.add_route('send_sms','/sms/single/{extension}/')
config.add_route('broadcast_sms','/sms/broadcast/')
config.add_route('scripts','/scripts/')
config.add_route('manage_service','/scripts/manage_service/{service}/{action}')
# static view setup
config.add_static_view('static', os.path.join(here, 'static'))
# scan for @view_config and @subscriber decorators
config.scan()
# serve app
log.debug('Listening for HTTP requests...')
return config.make_wsgi_app()

1987
hlr_mgmt/mcc_mnc.csv Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,179 @@
div.dataTables_length label {
float: left;
text-align: left;
}
div.dataTables_length select {
width: 75px;
}
div.dataTables_filter label {
float: right;
}
div.dataTables_info {
padding-top: 8px;
}
div.dataTables_paginate {
float: right;
margin: 0;
}
table.table {
clear: both;
margin-bottom: 6px !important;
max-width: none !important;
}
table.table thead .sorting,
table.table thead .sorting_asc,
table.table thead .sorting_desc,
table.table thead .sorting_asc_disabled,
table.table thead .sorting_desc_disabled {
cursor: pointer;
*cursor: hand;
}
table.table thead .sorting { background: url('images/sort_both.png') no-repeat center right; }
table.table thead .sorting_asc { background: url('images/sort_asc.png') no-repeat center right; }
table.table thead .sorting_desc { background: url('images/sort_desc.png') no-repeat center right; }
table.table thead .sorting_asc_disabled { background: url('images/sort_asc_disabled.png') no-repeat center right; }
table.table thead .sorting_desc_disabled { background: url('images/sort_desc_disabled.png') no-repeat center right; }
table.dataTable th:active {
outline: none;
}
/* Scrolling */
div.dataTables_scrollHead table {
margin-bottom: 0 !important;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
div.dataTables_scrollHead table thead tr:last-child th:first-child,
div.dataTables_scrollHead table thead tr:last-child td:first-child {
border-bottom-left-radius: 0 !important;
border-bottom-right-radius: 0 !important;
}
div.dataTables_scrollBody table {
border-top: none;
margin-bottom: 0 !important;
}
div.dataTables_scrollBody tbody tr:first-child th,
div.dataTables_scrollBody tbody tr:first-child td {
border-top: none;
}
div.dataTables_scrollFoot table {
border-top: none;
}
/*
* TableTools styles
*/
.table tbody tr.active td,
.table tbody tr.active th {
background-color: #08C;
color: white;
}
.table tbody tr.active:hover td,
.table tbody tr.active:hover th {
background-color: #0075b0 !important;
}
.table-striped tbody tr.active:nth-child(odd) td,
.table-striped tbody tr.active:nth-child(odd) th {
background-color: #017ebc;
}
table.DTTT_selectable tbody tr {
cursor: pointer;
*cursor: hand;
}
div.DTTT .btn {
color: #333 !important;
font-size: 12px;
}
div.DTTT .btn:hover {
text-decoration: none !important;
}
ul.DTTT_dropdown.dropdown-menu a {
color: #333 !important; /* needed only when demo_page.css is included */
}
ul.DTTT_dropdown.dropdown-menu li:hover a {
background-color: #0088cc;
color: white !important;
}
/* TableTools information display */
div.DTTT_print_info.modal {
height: 150px;
margin-top: -75px;
text-align: center;
}
div.DTTT_print_info h6 {
font-weight: normal;
font-size: 28px;
line-height: 28px;
margin: 1em;
}
div.DTTT_print_info p {
font-size: 14px;
line-height: 20px;
}
/*
* FixedColumns styles
*/
div.DTFC_LeftHeadWrapper table,
div.DTFC_LeftFootWrapper table,
table.DTFC_Cloned tr.even {
background-color: white;
}
div.DTFC_LeftHeadWrapper table {
margin-bottom: 0 !important;
border-top-right-radius: 0 !important;
border-bottom-left-radius: 0 !important;
border-bottom-right-radius: 0 !important;
}
div.DTFC_LeftHeadWrapper table thead tr:last-child th:first-child,
div.DTFC_LeftHeadWrapper table thead tr:last-child td:first-child {
border-bottom-left-radius: 0 !important;
border-bottom-right-radius: 0 !important;
}
div.DTFC_LeftBodyWrapper table {
border-top: none;
margin-bottom: 0 !important;
}
div.DTFC_LeftBodyWrapper tbody tr:first-child th,
div.DTFC_LeftBodyWrapper tbody tr:first-child td {
border-top: none;
}
div.DTFC_LeftFootWrapper table {
border-top: none;
}

View File

@ -0,0 +1,159 @@
/* Set the defaults for DataTables initialisation */
$.extend( true, $.fn.dataTable.defaults, {
"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
}
} );
/* Default class modification */
$.extend( $.fn.dataTableExt.oStdClasses, {
"sWrapper": "dataTables_wrapper form-inline"
} );
/* API method to get paging information */
$.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
{
return {
"iStart": oSettings._iDisplayStart,
"iEnd": oSettings.fnDisplayEnd(),
"iLength": oSettings._iDisplayLength,
"iTotal": oSettings.fnRecordsTotal(),
"iFilteredTotal": oSettings.fnRecordsDisplay(),
"iPage": oSettings._iDisplayLength === -1 ?
0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
"iTotalPages": oSettings._iDisplayLength === -1 ?
0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
};
};
/* Bootstrap style pagination control */
$.extend( $.fn.dataTableExt.oPagination, {
"bootstrap": {
"fnInit": function( oSettings, nPaging, fnDraw ) {
var oLang = oSettings.oLanguage.oPaginate;
var fnClickHandler = function ( e ) {
e.preventDefault();
if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) {
fnDraw( oSettings );
}
};
$(nPaging).addClass('pagination').append(
'<ul>'+
'<li class="prev disabled"><a href="#">&larr; '+oLang.sPrevious+'</a></li>'+
'<li class="next disabled"><a href="#">'+oLang.sNext+' &rarr; </a></li>'+
'</ul>'
);
var els = $('a', nPaging);
$(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler );
$(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler );
},
"fnUpdate": function ( oSettings, fnDraw ) {
var iListLength = 5;
var oPaging = oSettings.oInstance.fnPagingInfo();
var an = oSettings.aanFeatures.p;
var i, ien, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
if ( oPaging.iTotalPages < iListLength) {
iStart = 1;
iEnd = oPaging.iTotalPages;
}
else if ( oPaging.iPage <= iHalf ) {
iStart = 1;
iEnd = iListLength;
} else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) {
iStart = oPaging.iTotalPages - iListLength + 1;
iEnd = oPaging.iTotalPages;
} else {
iStart = oPaging.iPage - iHalf + 1;
iEnd = iStart + iListLength - 1;
}
for ( i=0, ien=an.length ; i<ien ; i++ ) {
// Remove the middle elements
$('li:gt(0)', an[i]).filter(':not(:last)').remove();
// Add the new list items and their event handlers
for ( j=iStart ; j<=iEnd ; j++ ) {
sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
$('<li '+sClass+'><a href="#">'+j+'</a></li>')
.insertBefore( $('li:last', an[i])[0] )
.bind('click', function (e) {
e.preventDefault();
oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
fnDraw( oSettings );
} );
}
// Add / remove disabled classes from the static elements
if ( oPaging.iPage === 0 ) {
$('li:first', an[i]).addClass('disabled');
} else {
$('li:first', an[i]).removeClass('disabled');
}
if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
$('li:last', an[i]).addClass('disabled');
} else {
$('li:last', an[i]).removeClass('disabled');
}
}
}
}
} );
/*
* TableTools Bootstrap compatibility
* Required TableTools 2.1+
*/
if ( $.fn.DataTable.TableTools ) {
// Set the classes that TableTools uses to something suitable for Bootstrap
$.extend( true, $.fn.DataTable.TableTools.classes, {
"container": "DTTT btn-group",
"buttons": {
"normal": "btn",
"disabled": "disabled"
},
"collection": {
"container": "DTTT_dropdown dropdown-menu",
"buttons": {
"normal": "",
"disabled": "disabled"
}
},
"print": {
"info": "DTTT_print_info modal"
},
"select": {
"row": "active"
}
} );
// Have the collection use a bootstrap compatible dropdown
$.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, {
"collection": {
"container": "ul",
"button": "li",
"liner": "a"
}
} );
}
/* Table initialisation */
$(document).ready(function() {
$('#example').dataTable( {
"sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
}
} );
} );

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,421 @@
/*! X-editable - v1.1.1
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
* http://github.com/vitalets/x-editable
* Copyright (c) 2012 Vitaliy Potapov; Licensed MIT */
.editableform {
margin-bottom: 0; /* overwrites bootstrap margin */
}
.editableform .control-group {
margin-bottom: 0; /* overwrites bootstrap margin */
white-space: nowrap; /* prevent wrapping buttons on new line */
}
.editable-buttons {
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
vertical-align: top;
margin-left: 7px;
/* display-inline emulation for IE7*/
zoom: 1;
*display: inline;
}
.editable-input {
vertical-align: top;
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
width: auto; /* bootstrap-responsive has width: 100% that breakes layout */
white-space: normal; /* reset white-space decalred in parent*/
/* display-inline emulation for IE7*/
zoom: 1;
*display: inline;
}
.editable-buttons .editable-cancel {
margin-left: 7px;
}
/*for jquery-ui buttons need set height to look more pretty*/
.editable-buttons button.ui-button {
height: 24px;
}
.editableform-loading {
background: url('img/loading.gif') center center no-repeat;
height: 25px;
width: auto;
min-width: 25px;
}
.editable-inline .editableform-loading {
background-position: left 5px;
}
.editable-error-block {
max-width: 300px;
margin: 5px 0 0 0;
width: auto;
}
/*add padding for jquery ui*/
.editable-error-block.ui-state-error {
padding: 3px;
}
.editable-error {
color: red;
}
.editableform textarea {
height: 150px; /*default height for textarea*/
}
.editableform .editable-date {
padding: 0;
margin: 0;
float: left;
}
/* checklist vertical alignment */
.editable-checklist label input[type="checkbox"],
.editable-checklist label span {
vertical-align: middle;
margin: 0;
}
.editable-clear {
clear: both;
font-size: 0.9em;
text-decoration: none;
text-align: right;
}
.editable-container {
max-width: none; /* without this rule poshytip does not stretch */
}
.editable-container.popover {
/* width: 300px;*/ /* debug */
width: auto; /* without this rule popover does not stretch */
}
.editable-container.editable-inline {
display: inline;
vertical-align: middle;
}
.editable-click,
a.editable-click,
a.editable-click:hover {
text-decoration: none;
border-bottom: dashed 1px #0088cc;
}
.editable-click.editable-disabled,
a.editable-click.editable-disabled,
a.editable-click.editable-disabled:hover {
color: #585858;
cursor: default;
border-bottom: none;
}
.editable-empty, .editable-empty:hover{
font-style: italic;
color: #DD1144;
border-bottom: none;
text-decoration: none;
}
.editable-unsaved {
font-weight: bold;
}
.editable-unsaved:after {
/* content: '*'*/
}
/*!
* Datepicker for Bootstrap
*
* Copyright 2012 Stefan Petre
* Improvements by Andrew Rowls
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
.datepicker {
padding: 4px;
margin-top: 1px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
/*.dow {
border-top: 1px solid #ddd !important;
}*/
}
.datepicker-inline {
width: 220px;
/* height: 220px; */
}
.datepicker-float {
top: 0;
left: 0;
}
.datepicker-float:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
top: -7px;
left: 6px;
}
.datepicker-float:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
position: absolute;
top: -6px;
left: 7px;
}
.datepicker > div {
display: none;
}
.datepicker.days div.datepicker-days {
display: block;
}
.datepicker.months div.datepicker-months {
display: block;
}
.datepicker.years div.datepicker-years {
display: block;
}
.datepicker table {
margin: 0;
}
.datepicker td,
.datepicker th {
text-align: center;
width: 20px;
height: 20px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
/* vitalets: required to disable css inheritance when display inline inside table */
border: none !important;
background-color: transparent !important;
}
.datepicker td.day:hover {
background: #eeeeee !important; /* disable inheritance for inline */
cursor: pointer;
}
.datepicker td.old,
.datepicker td.new {
color: #999999;
}
.datepicker td.disabled,
.datepicker td.disabled:hover {
background: none;
color: #999999;
cursor: default;
}
.datepicker td.today,
.datepicker td.today:hover,
.datepicker td.today.disabled,
.datepicker td.today.disabled:hover {
background-color: #fde19a !important; /* disable inheritance for inline */
background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a);
background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
background-image: linear-gradient(top, #fdd49a, #fdf59a);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
border-color: #fdf59a #fdf59a #fbed50;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
}
.datepicker td.today:hover,
.datepicker td.today:hover:hover,
.datepicker td.today.disabled:hover,
.datepicker td.today.disabled:hover:hover,
.datepicker td.today:active,
.datepicker td.today:hover:active,
.datepicker td.today.disabled:active,
.datepicker td.today.disabled:hover:active,
.datepicker td.today.active,
.datepicker td.today:hover.active,
.datepicker td.today.disabled.active,
.datepicker td.today.disabled:hover.active,
.datepicker td.today.disabled,
.datepicker td.today:hover.disabled,
.datepicker td.today.disabled.disabled,
.datepicker td.today.disabled:hover.disabled,
.datepicker td.today[disabled],
.datepicker td.today:hover[disabled],
.datepicker td.today.disabled[disabled],
.datepicker td.today.disabled:hover[disabled] {
background-color: #fdf59a !important; /* disable inheritance for inline */
}
.datepicker td.today:active,
.datepicker td.today:hover:active,
.datepicker td.today.disabled:active,
.datepicker td.today.disabled:hover:active,
.datepicker td.today.active,
.datepicker td.today:hover.active,
.datepicker td.today.disabled.active,
.datepicker td.today.disabled:hover.active {
background-color: #fbf069 \9;
}
.datepicker td.active,
.datepicker td.active:hover,
.datepicker td.active.disabled,
.datepicker td.active.disabled:hover {
background-color: #006dcc !important; /* disable inheritance for inline */
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(top, #0088cc, #0044cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datepicker td.active:hover,
.datepicker td.active:hover:hover,
.datepicker td.active.disabled:hover,
.datepicker td.active.disabled:hover:hover,
.datepicker td.active:active,
.datepicker td.active:hover:active,
.datepicker td.active.disabled:active,
.datepicker td.active.disabled:hover:active,
.datepicker td.active.active,
.datepicker td.active:hover.active,
.datepicker td.active.disabled.active,
.datepicker td.active.disabled:hover.active,
.datepicker td.active.disabled,
.datepicker td.active:hover.disabled,
.datepicker td.active.disabled.disabled,
.datepicker td.active.disabled:hover.disabled,
.datepicker td.active[disabled],
.datepicker td.active:hover[disabled],
.datepicker td.active.disabled[disabled],
.datepicker td.active.disabled:hover[disabled] {
background-color: #0044cc;
}
.datepicker td.active:active,
.datepicker td.active:hover:active,
.datepicker td.active.disabled:active,
.datepicker td.active.disabled:hover:active,
.datepicker td.active.active,
.datepicker td.active:hover.active,
.datepicker td.active.disabled.active,
.datepicker td.active.disabled:hover.active {
background-color: #003399 \9;
}
.datepicker td span {
display: block;
width: 23%;
height: 54px;
line-height: 54px;
float: left;
margin: 1%;
cursor: pointer;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.datepicker td span:hover {
background: #eeeeee;
}
.datepicker td span.disabled,
.datepicker td span.disabled:hover {
background: none;
color: #999999;
cursor: default;
}
.datepicker td span.active,
.datepicker td span.active:hover,
.datepicker td span.active.disabled,
.datepicker td span.active.disabled:hover {
background-color: #006dcc;
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(top, #0088cc, #0044cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datepicker td span.active:hover,
.datepicker td span.active:hover:hover,
.datepicker td span.active.disabled:hover,
.datepicker td span.active.disabled:hover:hover,
.datepicker td span.active:active,
.datepicker td span.active:hover:active,
.datepicker td span.active.disabled:active,
.datepicker td span.active.disabled:hover:active,
.datepicker td span.active.active,
.datepicker td span.active:hover.active,
.datepicker td span.active.disabled.active,
.datepicker td span.active.disabled:hover.active,
.datepicker td span.active.disabled,
.datepicker td span.active:hover.disabled,
.datepicker td span.active.disabled.disabled,
.datepicker td span.active.disabled:hover.disabled,
.datepicker td span.active[disabled],
.datepicker td span.active:hover[disabled],
.datepicker td span.active.disabled[disabled],
.datepicker td span.active.disabled:hover[disabled] {
background-color: #0044cc;
}
.datepicker td span.active:active,
.datepicker td span.active:hover:active,
.datepicker td span.active.disabled:active,
.datepicker td span.active.disabled:hover:active,
.datepicker td span.active.active,
.datepicker td span.active:hover.active,
.datepicker td span.active.disabled.active,
.datepicker td span.active.disabled:hover.active {
background-color: #003399 \9;
}
.datepicker td span.old {
color: #999999;
}
.datepicker th.switch {
width: 145px;
}
.datepicker thead tr:first-child th,
.datepicker tfoot tr:first-child th {
cursor: pointer;
}
.datepicker thead tr:first-child th:hover,
.datepicker tfoot tr:first-child th:hover {
background: #eeeeee;
}
.input-append.date .add-on i,
.input-prepend.date .add-on i {
display: block;
cursor: pointer;
width: 16px;
height: 16px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,13 @@
/**
* Brazilian translation for bootstrap-datepicker
* Cauan Cabral <cauan@radig.com.br>
*/
;(function($){
$.fn.datepicker.dates['br'] = {
days: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado", "Domingo"],
daysShort: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb", "Dom"],
daysMin: ["Do", "Se", "Te", "Qu", "Qu", "Se", "Sa", "Do"],
months: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"],
monthsShort: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Czech translation for bootstrap-datepicker
* Matěj Koubík <matej@koubik.name>
*/
;(function($){
$.fn.datepicker.dates['cs'] = {
days: ["Neděle", "Pondělí", "Úterý", "Středa", "Čtvrtek", "Pátek", "Sobota", "Neděle"],
daysShort: ["Ne", "Po", "Út", "St", "Čt", "Pá", "So", "Ne"],
daysMin: ["N", "P", "Ú", "St", "Č", "P", "So", "N"],
months: ["Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"],
monthsShort: ["Led", "Úno", "Bře", "Dub", "Kvě", "Čer", "Čnc", "Srp", "Zář", "Říj", "Lis", "Pro"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Danish translation for bootstrap-datepicker
* Christian Pedersen <http://github.com/chripede>
*/
;(function($){
$.fn.datepicker.dates['da'] = {
days: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"],
daysShort: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søn"],
daysMin: ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø", "Sø"],
months: ["Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* German translation for bootstrap-datepicker
* Sam Zurcher <sam@orelias.ch>
*/
;(function($){
$.fn.datepicker.dates['de'] = {
days: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"],
daysShort: ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam", "Son"],
daysMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"],
months: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
monthsShort: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Spanish translation for bootstrap-datepicker
* Bruno Bonamin <bruno.bonamin@gmail.com>
*/
;(function($){
$.fn.datepicker.dates['es'] = {
days: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"],
daysShort: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb", "Dom"],
daysMin: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa", "Do"],
months: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
monthsShort: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Finnish translation for bootstrap-datepicker
* Jaakko Salonen <https://github.com/jsalonen>
*/
;(function($){
$.fn.datepicker.dates['fi'] = {
days: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai", "sunnuntai"],
daysShort: ["sun", "maa", "tii", "kes", "tor", "per", "lau", "sun"],
daysMin: ["su", "ma", "ti", "ke", "to", "pe", "la", "su"],
months: ["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kesäkuu", "heinäkuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"],
monthsShort: ["tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mar", "jou"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* French translation for bootstrap-datepicker
* Nico Mollet <nico.mollet@gmail.com>
*/
;(function($){
$.fn.datepicker.dates['fr'] = {
days: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"],
daysShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam", "Dim"],
daysMin: ["D", "L", "Ma", "Me", "J", "V", "S", "D"],
months: ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"],
monthsShort: ["Jan", "Fev", "Mar", "Avr", "Mai", "Jui", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Bahasa translation for bootstrap-datepicker
* Azwar Akbar <azwar.akbar@gmail.com>
*/
;(function($){
$.fn.datepicker.dates['id'] = {
days: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu"],
daysShort: ["Mgu", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab", "Mgu"],
daysMin: ["Mg", "Sn", "Sl", "Ra", "Ka", "Ju", "Sa", "Mg"],
months: ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Ags", "Sep", "Okt", "Nov", "Des"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Icelandic translation for bootstrap-datepicker
* Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
*/
;(function($){
$.fn.datepicker.dates['is'] = {
days: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur", "Sunnudagur"],
daysShort: ["Sun", "Mán", "Þri", "Mið", "Fim", "Fös", "Lau", "Sun"],
daysMin: ["Su", "Má", "Þr", "Mi", "Fi", "Fö", "La", "Su"],
months: ["Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maí", "Jún", "Júl", "Ágú", "Sep", "Okt", "Nóv", "Des"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Italian translation for bootstrap-datepicker
* Enrico Rubboli <rubboli@gmail.com>
*/
;(function($){
$.fn.datepicker.dates['it'] = {
days: ["Domenica", "Lunedi", "Martedi", "Mercoledi", "Giovedi", "Venerdi", "Sabato", "Domenica"],
daysShort: ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab", "Dom"],
daysMin: ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa", "Do"],
months: ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"],
monthsShort: ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Japanese translation for bootstrap-datepicker
* Norio Suzuki <https://github.com/suzuki/>
*/
;(function($){
$.fn.datepicker.dates['ja'] = {
days: ["日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜", "日曜"],
daysShort: ["日", "月", "火", "水", "木", "金", "土", "日"],
daysMin: ["日", "月", "火", "水", "木", "金", "土", "日"],
months: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
monthsShort: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Korean translation for bootstrap-datepicker
* Gu Youn <http://github.com/guyoun>
*/
;(function($){
$.fn.datepicker.dates['kr'] = {
days: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일", "일요일"],
daysShort: ["일", "월", "화", "수", "목", "금", "토", "일"],
daysMin: ["일", "월", "화", "수", "목", "금", "토", "일"],
months: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"],
monthsShort: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"],
};
}(jQuery));

View File

@ -0,0 +1,15 @@
/**
* Lithuanian translation for bootstrap-datepicker
* Šarūnas Gliebus <ssharunas@yahoo.co.uk>
*/
;(function($){
$.fn.datepicker.dates['lt'] = {
days: ["Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis", "Sekmadienis"],
daysShort: ["S", "Pr", "A", "T", "K", "Pn", "Š", "S"],
daysMin: ["Sk", "Pr", "An", "Tr", "Ke", "Pn", "Št", "Sk"],
months: ["Sausis", "Vasaris", "Kovas", "Balandis", "Gegužė", "Birželis", "Liepa", "Rugpjūtis", "Rugsėjis", "Spalis", "Lapkritis", "Gruodis"],
monthsShort: ["Sau", "Vas", "Kov", "Bal", "Geg", "Bir", "Lie", "Rugp", "Rugs", "Spa", "Lap", "Gru"],
weekStart: 1
};
}(jQuery));

View File

@ -0,0 +1,15 @@
/**
* Latvian translation for bootstrap-datepicker
* Artis Avotins <artis@apit.lv>
*/
;(function($){
$.fn.datepicker.dates['lv'] = {
days: ["Svētdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena", "Svētdiena"],
daysShort: ["Sv", "P", "O", "T", "C", "Pk", "S", "Sv"],
daysMin: ["Sv", "Pr", "Ot", "Tr", "Ce", "Pk", "St", "Sv"],
months: ["Janvāris", "Februāris", "Marts", "Aprīlis", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mai", "Jūn", "Jūl", "Aug", "Sep", "Okt", "Nov", "Dec."],
weekStart: 1
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Malay translation for bootstrap-datepicker
* Ateman Faiz <noorulfaiz@gmail.com>
*/
;(function($){
$.fn.datepicker.dates['ms'] = {
days: ["Ahad", "Isnin", "Selasa", "Rabu", "Khamis", "Jumaat", "Sabtu", "Ahad"],
daysShort: ["Aha", "Isn", "Sel", "Rab", "Kha", "Jum", "Sab", "Aha"],
daysMin: ["Ah", "Is", "Se", "Ra", "Kh", "Ju", "Sa", "Ah"],
months: ["Januari", "Februari", "Mac", "April", "Mei", "Jun", "Julai", "Ogos", "September", "Oktober", "November", "Disember"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Ogo", "Sep", "Okt", "Nov", "Dis"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Norwegian (bokmål) translation for bootstrap-datepicker
* Fredrik Sundmyhr <http://github.com/fsundmyhr>
*/
;(function($){
$.fn.datepicker.dates['nb'] = {
days: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"],
daysShort: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søn"],
daysMin: ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø", "Sø"],
months: ["Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Dutch translation for bootstrap-datepicker
* Reinier Goltstein <mrgoltstein@gmail.com>
*/
;(function($){
$.fn.datepicker.dates['nl'] = {
days: ["Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag", "Zondag"],
daysShort: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za", "Zo"],
daysMin: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za", "Zo"],
months: ["Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December"],
monthsShort: ["Jan", "Feb", "Mrt", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Polish translation for bootstrap-datepicker
* Robert <rtpm@gazeta.pl>
*/
;(function($){
$.fn.datepicker.dates['pl'] = {
days: ["Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota", "Niedziela"],
daysShort: ["Nie", "Pn", "Wt", "Śr", "Czw", "Pt", "So", "Nie"],
daysMin: ["N", "Pn", "Wt", "Śr", "Cz", "Pt", "So", "N"],
months: ["Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"],
monthsShort: ["Sty", "Lu", "Mar", "Kw", "Maj", "Cze", "Lip", "Sie", "Wrz", "Pa", "Lis", "Gru"]
};
}(jQuery));

View File

@ -0,0 +1,14 @@
/**
* Portuguese translation for bootstrap-datepicker
* Original code: Cauan Cabral <cauan@radig.com.br>
* Tiago Melo <tiago.blackcode@gmail.com>
*/
;(function($){
$.fn.datepicker.dates['pt'] = {
days: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado", "Domingo"],
daysShort: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb", "Dom"],
daysMin: ["Do", "Se", "Te", "Qu", "Qu", "Se", "Sa", "Do"],
months: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"],
monthsShort: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Russian translation for bootstrap-datepicker
* Victor Taranenko <darwin@snowdale.com>
*/
;(function($){
$.fn.datepicker.dates['ru'] = {
days: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота", "Воскресенье"],
daysShort: ["Вск", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Суб", "Вск"],
daysMin: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"],
months: ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"],
monthsShort: ["Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Swedish translation for bootstrap-datepicker
* Patrik Ragnarsson <patrik@starkast.net>
*/
;(function($){
$.fn.datepicker.dates['sv'] = {
days: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag", "Söndag"],
daysShort: ["Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör", "Sön"],
daysMin: ["Sö", "Må", "Ti", "On", "To", "Fr", "Lö", "Sö"],
months: ["Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Thai translation for bootstrap-datepicker
* Suchau Jiraprapot <seroz24@gmail.com>
*/
;(function($){
$.fn.datepicker.dates['th'] = {
days: ["อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัส", "ศุกร์", "เสาร์", "อาทิตย์"],
daysShort: ["อา", "จ", "อ", "พ", "พฤ", "ศ", "ส", "อา"],
daysMin: ["อา", "จ", "อ", "พ", "พฤ", "ศ", "ส", "อา"],
months: ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"],
monthsShort: ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."]
};
}(jQuery));

View File

@ -0,0 +1,14 @@
/**
* Turkish translation for bootstrap-datepicker
* Serkan Algur <kaisercrazy_2@hotmail.com>
*/
;(function($){
$.fn.datepicker.dates['tr'] = {
days: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi", "Pazar"],
daysShort: ["Pz", "Pzt", "Sal", "Çrş", "Prş", "Cu", "Cts", "Pz"],
daysMin: ["Pz", "Pzt", "Sa", "Çr", "Pr", "Cu", "Ct", "Pz"],
months: ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"],
monthsShort: ["Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Simplified Chinese translation for bootstrap-datepicker
* Yuan Cheung <advanimal@gmail.com>
*/
;(function($){
$.fn.datepicker.dates['zh-CN'] = {
days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"]
};
}(jQuery));

View File

@ -0,0 +1,13 @@
/**
* Traditional Chinese translation for bootstrap-datepicker
* Rung-Sheng Jang <daniel@i-trend.co.cc>
*/
;(function($){
$.fn.datepicker.dates['zh-TW'] = {
days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"]
};
}(jQuery));

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,106 @@
## 2.0 BOOTSTRAP JS PHILOSOPHY
These are the high-level design rules which guide the development of Bootstrap's plugin apis.
---
### DATA-ATTRIBUTE API
We believe you should be able to use all plugins provided by Bootstrap purely through the markup API without writing a single line of javascript.
We acknowledge that this isn't always the most performant and sometimes it may be desirable to turn this functionality off altogether. Therefore, as of 2.0 we provide the ability to disable the data attribute API by unbinding all events on the body namespaced with `'data-api'`. This looks like this:
$('body').off('.data-api')
To target a specific plugin, just include the plugins name as a namespace along with the data-api namespace like this:
$('body').off('.alert.data-api')
---
### PROGRAMATIC API
We also believe you should be able to use all plugins provided by Bootstrap purely through the JS API.
All public APIs should be single, chainable methods, and return the collection acted upon.
$(".btn.danger").button("toggle").addClass("fat")
All methods should accept an optional options object, a string which targets a particular method, or null which initiates the default behavior:
$("#myModal").modal() // initialized with defaults
$("#myModal").modal({ keyboard: false }) // initialized with now keyboard
$("#myModal").modal('show') // initializes and invokes show immediately afterqwe2
---
### OPTIONS
Options should be sparse and add universal value. We should pick the right defaults.
All plugins should have a default object which can be modified to effect all instance's default options. The defaults object should be available via `$.fn.plugin.defaults`.
$.fn.modal.defaults = { … }
An options definition should take the following form:
*noun*: *adjective* - describes or modifies a quality of an instance
examples:
backdrop: true
keyboard: false
placement: 'top'
---
### EVENTS
All events should have an infinitive and past participle form. The infinitive is fired just before an action takes place, the past participle on completion of the action.
show | shown
hide | hidden
---
### CONSTRUCTORS
Each plugin should expose it's raw constructor on a `Constructor` property -- accessed in the following way:
$.fn.popover.Constructor
---
### DATA ACCESSOR
Each plugin stores a copy of the invoked class on an object. This class instance can be accessed directly through jQuery's data API like this:
$('[rel=popover]').data('popover') instanceof $.fn.popover.Constructor
---
### DATA ATTRIBUTES
Data attributes should take the following form:
- data-{{verb}}={{plugin}} - defines main interaction
- data-target || href^=# - defined on "control" element (if element controls an element other than self)
- data-{{noun}} - defines class instance options
examples:
// control other targets
data-toggle="modal" data-target="#foo"
data-toggle="collapse" data-target="#foo" data-parent="#bar"
// defined on element they control
data-spy="scroll"
data-dismiss="modal"
data-dismiss="alert"
data-toggle="dropdown"
data-toggle="button"
data-toggle="buttons-checkbox"
data-toggle="buttons-radio"

View File

@ -0,0 +1,154 @@
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
// IT'S ALL JUST JUNK FOR OUR DOCS!
// ++++++++++++++++++++++++++++++++++++++++++
!function ($) {
$(function(){
var $window = $(window)
// Disable certain links in docs
$('section [href^=#]').click(function (e) {
e.preventDefault()
})
// side bar
$('.bs-docs-sidenav').affix({
offset: {
top: function () { return $window.width() <= 980 ? 290 : 210 }
, bottom: 270
}
})
// make code pretty
window.prettyPrint && prettyPrint()
// add-ons
$('.add-on :checkbox').on('click', function () {
var $this = $(this)
, method = $this.attr('checked') ? 'addClass' : 'removeClass'
$(this).parents('.add-on')[method]('active')
})
// add tipsies to grid for scaffolding
if ($('#gridSystem').length) {
$('#gridSystem').tooltip({
selector: '.show-grid > div'
, title: function () { return $(this).width() + 'px' }
})
}
// tooltip demo
$('.tooltip-demo').tooltip({
selector: "a[rel=tooltip]"
})
$('.tooltip-test').tooltip()
$('.popover-test').popover()
// popover demo
$("a[rel=popover]")
.popover()
.click(function(e) {
e.preventDefault()
})
// button state demo
$('#fat-btn')
.click(function () {
var btn = $(this)
btn.button('loading')
setTimeout(function () {
btn.button('reset')
}, 3000)
})
// carousel demo
$('#myCarousel').carousel()
// javascript build logic
var inputsComponent = $("#components.download input")
, inputsPlugin = $("#plugins.download input")
, inputsVariables = $("#variables.download input")
// toggle all plugin checkboxes
$('#components.download .toggle-all').on('click', function (e) {
e.preventDefault()
inputsComponent.attr('checked', !inputsComponent.is(':checked'))
})
$('#plugins.download .toggle-all').on('click', function (e) {
e.preventDefault()
inputsPlugin.attr('checked', !inputsPlugin.is(':checked'))
})
$('#variables.download .toggle-all').on('click', function (e) {
e.preventDefault()
inputsVariables.val('')
})
// request built javascript
$('.download-btn').on('click', function () {
var css = $("#components.download input:checked")
.map(function () { return this.value })
.toArray()
, js = $("#plugins.download input:checked")
.map(function () { return this.value })
.toArray()
, vars = {}
, img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png']
$("#variables.download input")
.each(function () {
$(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
})
$.ajax({
type: 'POST'
, url: /\?dev/.test(window.location) ? 'http://localhost:3000' : 'http://bootstrap.herokuapp.com'
, dataType: 'jsonpi'
, params: {
js: js
, css: css
, vars: vars
, img: img
}
})
})
})
// Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
$.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
var url = opts.url;
return {
send: function(_, completeCallback) {
var name = 'jQuery_iframe_' + jQuery.now()
, iframe, form
iframe = $('<iframe>')
.attr('name', name)
.appendTo('head')
form = $('<form>')
.attr('method', opts.type) // GET or POST
.attr('action', url)
.attr('target', name)
$.each(opts.params, function(k, v) {
$('<input>')
.attr('type', 'hidden')
.attr('name', k)
.attr('value', typeof v == 'string' ? v : JSON.stringify(v))
.appendTo(form)
})
form.appendTo('body').submit()
}
}
})
}(window.jQuery)

View File

@ -0,0 +1,106 @@
/* ==========================================================
* bootstrap-affix.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#affix
* ==========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
!function ($) {
"use strict"; // jshint ;_;
/* AFFIX CLASS DEFINITION
* ====================== */
var Affix = function (element, options) {
this.options = $.extend({}, $.fn.affix.defaults, options)
this.$window = $(window)
.on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
this.$element = $(element)
this.checkPosition()
}
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
var scrollHeight = $(document).height()
, scrollTop = this.$window.scrollTop()
, position = this.$element.offset()
, offset = this.options.offset
, offsetBottom = offset.bottom
, offsetTop = offset.top
, reset = 'affix affix-top affix-bottom'
, affix
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top()
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
'bottom' : offsetTop != null && scrollTop <= offsetTop ?
'top' : false
if (this.affixed === affix) return
this.affixed = affix
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
}
/* AFFIX PLUGIN DEFINITION
* ======================= */
$.fn.affix = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('affix')
, options = typeof option == 'object' && option
if (!data) $this.data('affix', (data = new Affix(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.affix.Constructor = Affix
$.fn.affix.defaults = {
offset: 0
}
/* AFFIX DATA-API
* ============== */
$(window).on('load', function () {
$('[data-spy="affix"]').each(function () {
var $spy = $(this)
, data = $spy.data()
data.offset = data.offset || {}
data.offsetBottom && (data.offset.bottom = data.offsetBottom)
data.offsetTop && (data.offset.top = data.offsetTop)
$spy.affix(data)
})
})
}(window.jQuery);

View File

@ -0,0 +1,88 @@
/* ==========================================================
* bootstrap-alert.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#alerts
* ==========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
!function ($) {
"use strict"; // jshint ;_;
/* ALERT CLASS DEFINITION
* ====================== */
var dismiss = '[data-dismiss="alert"]'
, Alert = function (el) {
$(el).on('click', dismiss, this.close)
}
Alert.prototype.close = function (e) {
var $this = $(this)
, selector = $this.attr('data-target')
, $parent
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
$parent = $(selector)
e && e.preventDefault()
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
$parent.trigger(e = $.Event('close'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement() {
$parent
.trigger('closed')
.remove()
}
$.support.transition && $parent.hasClass('fade') ?
$parent.on($.support.transition.end, removeElement) :
removeElement()
}
/* ALERT PLUGIN DEFINITION
* ======================= */
$.fn.alert = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('alert')
if (!data) $this.data('alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}
$.fn.alert.Constructor = Alert
/* ALERT DATA-API
* ============== */
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
}(window.jQuery);

View File

@ -0,0 +1,94 @@
/* ============================================================
* bootstrap-button.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#buttons
* ============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */
!function ($) {
"use strict"; // jshint ;_;
/* BUTTON PUBLIC CLASS DEFINITION
* ============================== */
var Button = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.button.defaults, options)
}
Button.prototype.setState = function (state) {
var d = 'disabled'
, $el = this.$element
, data = $el.data()
, val = $el.is('input') ? 'val' : 'html'
state = state + 'Text'
data.resetText || $el.data('resetText', $el[val]())
$el[val](data[state] || this.options[state])
// push to event loop to allow forms to submit
setTimeout(function () {
state == 'loadingText' ?
$el.addClass(d).attr(d, d) :
$el.removeClass(d).removeAttr(d)
}, 0)
}
Button.prototype.toggle = function () {
var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
$parent && $parent
.find('.active')
.removeClass('active')
this.$element.toggleClass('active')
}
/* BUTTON PLUGIN DEFINITION
* ======================== */
$.fn.button = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('button')
, options = typeof option == 'object' && option
if (!data) $this.data('button', (data = new Button(this, options)))
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}
$.fn.button.defaults = {
loadingText: 'loading...'
}
$.fn.button.Constructor = Button
/* BUTTON DATA-API
* =============== */
$(document).on('click.button.data-api', '[data-toggle^=button]', function (e) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
$btn.button('toggle')
})
}(window.jQuery);

View File

@ -0,0 +1,176 @@
/* ==========================================================
* bootstrap-carousel.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#carousel
* ==========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
!function ($) {
"use strict"; // jshint ;_;
/* CAROUSEL CLASS DEFINITION
* ========================= */
var Carousel = function (element, options) {
this.$element = $(element)
this.options = options
this.options.slide && this.slide(this.options.slide)
this.options.pause == 'hover' && this.$element
.on('mouseenter', $.proxy(this.pause, this))
.on('mouseleave', $.proxy(this.cycle, this))
}
Carousel.prototype = {
cycle: function (e) {
if (!e) this.paused = false
this.options.interval
&& !this.paused
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
return this
}
, to: function (pos) {
var $active = this.$element.find('.item.active')
, children = $active.parent().children()
, activePos = children.index($active)
, that = this
if (pos > (children.length - 1) || pos < 0) return
if (this.sliding) {
return this.$element.one('slid', function () {
that.to(pos)
})
}
if (activePos == pos) {
return this.pause().cycle()
}
return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
}
, pause: function (e) {
if (!e) this.paused = true
if (this.$element.find('.next, .prev').length && $.support.transition.end) {
this.$element.trigger($.support.transition.end)
this.cycle()
}
clearInterval(this.interval)
this.interval = null
return this
}
, next: function () {
if (this.sliding) return
return this.slide('next')
}
, prev: function () {
if (this.sliding) return
return this.slide('prev')
}
, slide: function (type, next) {
var $active = this.$element.find('.item.active')
, $next = next || $active[type]()
, isCycling = this.interval
, direction = type == 'next' ? 'left' : 'right'
, fallback = type == 'next' ? 'first' : 'last'
, that = this
, e
this.sliding = true
isCycling && this.pause()
$next = $next.length ? $next : this.$element.find('.item')[fallback]()
e = $.Event('slide', {
relatedTarget: $next[0]
})
if ($next.hasClass('active')) return
if ($.support.transition && this.$element.hasClass('slide')) {
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$next.addClass(type)
$next[0].offsetWidth // force reflow
$active.addClass(direction)
$next.addClass(direction)
this.$element.one($.support.transition.end, function () {
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding = false
setTimeout(function () { that.$element.trigger('slid') }, 0)
})
} else {
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$active.removeClass('active')
$next.addClass('active')
this.sliding = false
this.$element.trigger('slid')
}
isCycling && this.cycle()
return this
}
}
/* CAROUSEL PLUGIN DEFINITION
* ========================== */
$.fn.carousel = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('carousel')
, options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
, action = typeof option == 'string' ? option : options.slide
if (!data) $this.data('carousel', (data = new Carousel(this, options)))
if (typeof option == 'number') data.to(option)
else if (action) data[action]()
else if (options.interval) data.cycle()
})
}
$.fn.carousel.defaults = {
interval: 5000
, pause: 'hover'
}
$.fn.carousel.Constructor = Carousel
/* CAROUSEL DATA-API
* ================= */
$(document).on('click.carousel.data-api', '[data-slide]', function (e) {
var $this = $(this), href
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
, options = $.extend({}, $target.data(), $this.data())
$target.carousel(options)
e.preventDefault()
})
}(window.jQuery);

View File

@ -0,0 +1,156 @@
/* =============================================================
* bootstrap-collapse.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#collapse
* =============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */
!function ($) {
"use strict"; // jshint ;_;
/* COLLAPSE PUBLIC CLASS DEFINITION
* ================================ */
var Collapse = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.collapse.defaults, options)
if (this.options.parent) {
this.$parent = $(this.options.parent)
}
this.options.toggle && this.toggle()
}
Collapse.prototype = {
constructor: Collapse
, dimension: function () {
var hasWidth = this.$element.hasClass('width')
return hasWidth ? 'width' : 'height'
}
, show: function () {
var dimension
, scroll
, actives
, hasData
if (this.transitioning) return
dimension = this.dimension()
scroll = $.camelCase(['scroll', dimension].join('-'))
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
if (actives && actives.length) {
hasData = actives.data('collapse')
if (hasData && hasData.transitioning) return
actives.collapse('hide')
hasData || actives.data('collapse', null)
}
this.$element[dimension](0)
this.transition('addClass', $.Event('show'), 'shown')
$.support.transition && this.$element[dimension](this.$element[0][scroll])
}
, hide: function () {
var dimension
if (this.transitioning) return
dimension = this.dimension()
this.reset(this.$element[dimension]())
this.transition('removeClass', $.Event('hide'), 'hidden')
this.$element[dimension](0)
}
, reset: function (size) {
var dimension = this.dimension()
this.$element
.removeClass('collapse')
[dimension](size || 'auto')
[0].offsetWidth
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
return this
}
, transition: function (method, startEvent, completeEvent) {
var that = this
, complete = function () {
if (startEvent.type == 'show') that.reset()
that.transitioning = 0
that.$element.trigger(completeEvent)
}
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
this.transitioning = 1
this.$element[method]('in')
$.support.transition && this.$element.hasClass('collapse') ?
this.$element.one($.support.transition.end, complete) :
complete()
}
, toggle: function () {
this[this.$element.hasClass('in') ? 'hide' : 'show']()
}
}
/* COLLAPSIBLE PLUGIN DEFINITION
* ============================== */
$.fn.collapse = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('collapse')
, options = typeof option == 'object' && option
if (!data) $this.data('collapse', (data = new Collapse(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.collapse.defaults = {
toggle: true
}
$.fn.collapse.Constructor = Collapse
/* COLLAPSIBLE DATA-API
* ==================== */
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
var $this = $(this), href
, target = $this.attr('data-target')
|| e.preventDefault()
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
, option = $(target).data('collapse') ? 'toggle' : $this.data()
$this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
$(target).collapse(option)
})
}(window.jQuery);

View File

@ -0,0 +1,148 @@
/* ============================================================
* bootstrap-dropdown.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
* ============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */
!function ($) {
"use strict"; // jshint ;_;
/* DROPDOWN CLASS DEFINITION
* ========================= */
var toggle = '[data-toggle=dropdown]'
, Dropdown = function (element) {
var $el = $(element).on('click.dropdown.data-api', this.toggle)
$('html').on('click.dropdown.data-api', function () {
$el.parent().removeClass('open')
})
}
Dropdown.prototype = {
constructor: Dropdown
, toggle: function (e) {
var $this = $(this)
, $parent
, isActive
if ($this.is('.disabled, :disabled')) return
$parent = getParent($this)
isActive = $parent.hasClass('open')
clearMenus()
if (!isActive) {
$parent.toggleClass('open')
$this.focus()
}
return false
}
, keydown: function (e) {
var $this
, $items
, $active
, $parent
, isActive
, index
if (!/(38|40|27)/.test(e.keyCode)) return
$this = $(this)
e.preventDefault()
e.stopPropagation()
if ($this.is('.disabled, :disabled')) return
$parent = getParent($this)
isActive = $parent.hasClass('open')
if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
$items = $('[role=menu] li:not(.divider) a', $parent)
if (!$items.length) return
index = $items.index($items.filter(':focus'))
if (e.keyCode == 38 && index > 0) index-- // up
if (e.keyCode == 40 && index < $items.length - 1) index++ // down
if (!~index) index = 0
$items
.eq(index)
.focus()
}
}
function clearMenus() {
$(toggle).each(function () {
getParent($(this)).removeClass('open')
})
}
function getParent($this) {
var selector = $this.attr('data-target')
, $parent
if (!selector) {
selector = $this.attr('href')
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
$parent = $(selector)
$parent.length || ($parent = $this.parent())
return $parent
}
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
$.fn.dropdown = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('dropdown')
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
if (typeof option == 'string') data[option].call($this)
})
}
$.fn.dropdown.Constructor = Dropdown
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
$(document)
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
}(window.jQuery);

View File

@ -0,0 +1,234 @@
/* =========================================================
* bootstrap-modal.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#modals
* =========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================= */
!function ($) {
"use strict"; // jshint ;_;
/* MODAL CLASS DEFINITION
* ====================== */
var Modal = function (element, options) {
this.options = options
this.$element = $(element)
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
}
Modal.prototype = {
constructor: Modal
, toggle: function () {
return this[!this.isShown ? 'show' : 'hide']()
}
, show: function () {
var that = this
, e = $.Event('show')
this.$element.trigger(e)
if (this.isShown || e.isDefaultPrevented()) return
this.isShown = true
this.escape()
this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade')
if (!that.$element.parent().length) {
that.$element.appendTo(document.body) //don't move modals dom position
}
that.$element
.show()
if (transition) {
that.$element[0].offsetWidth // force reflow
}
that.$element
.addClass('in')
.attr('aria-hidden', false)
that.enforceFocus()
transition ?
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
that.$element.focus().trigger('shown')
})
}
, hide: function (e) {
e && e.preventDefault()
var that = this
e = $.Event('hide')
this.$element.trigger(e)
if (!this.isShown || e.isDefaultPrevented()) return
this.isShown = false
this.escape()
$(document).off('focusin.modal')
this.$element
.removeClass('in')
.attr('aria-hidden', true)
$.support.transition && this.$element.hasClass('fade') ?
this.hideWithTransition() :
this.hideModal()
}
, enforceFocus: function () {
var that = this
$(document).on('focusin.modal', function (e) {
if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
that.$element.focus()
}
})
}
, escape: function () {
var that = this
if (this.isShown && this.options.keyboard) {
this.$element.on('keyup.dismiss.modal', function ( e ) {
e.which == 27 && that.hide()
})
} else if (!this.isShown) {
this.$element.off('keyup.dismiss.modal')
}
}
, hideWithTransition: function () {
var that = this
, timeout = setTimeout(function () {
that.$element.off($.support.transition.end)
that.hideModal()
}, 500)
this.$element.one($.support.transition.end, function () {
clearTimeout(timeout)
that.hideModal()
})
}
, hideModal: function (that) {
this.$element
.hide()
.trigger('hidden')
this.backdrop()
}
, removeBackdrop: function () {
this.$backdrop.remove()
this.$backdrop = null
}
, backdrop: function (callback) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body)
this.$backdrop.click(
this.options.backdrop == 'static' ?
$.proxy(this.$element[0].focus, this.$element[0])
: $.proxy(this.hide, this)
)
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
this.$backdrop.addClass('in')
doAnimate ?
this.$backdrop.one($.support.transition.end, callback) :
callback()
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in')
$.support.transition && this.$element.hasClass('fade')?
this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) :
this.removeBackdrop()
} else if (callback) {
callback()
}
}
}
/* MODAL PLUGIN DEFINITION
* ======================= */
$.fn.modal = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('modal')
, options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option]()
else if (options.show) data.show()
})
}
$.fn.modal.defaults = {
backdrop: true
, keyboard: true
, show: true
}
$.fn.modal.Constructor = Modal
/* MODAL DATA-API
* ============== */
$(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
var $this = $(this)
, href = $this.attr('href')
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
, option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
e.preventDefault()
$target
.modal(option)
.one('hide', function () {
$this.focus()
})
})
}(window.jQuery);

View File

@ -0,0 +1,103 @@
/* ===========================================================
* bootstrap-popover.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#popovers
* ===========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =========================================================== */
!function ($) {
"use strict"; // jshint ;_;
/* POPOVER PUBLIC CLASS DEFINITION
* =============================== */
var Popover = function (element, options) {
this.init('popover', element, options)
}
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
========================================== */
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
constructor: Popover
, setContent: function () {
var $tip = this.tip()
, title = this.getTitle()
, content = this.getContent()
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
$tip.find('.popover-content > *')[this.options.html ? 'html' : 'text'](content)
$tip.removeClass('fade top bottom left right in')
}
, hasContent: function () {
return this.getTitle() || this.getContent()
}
, getContent: function () {
var content
, $e = this.$element
, o = this.options
content = $e.attr('data-content')
|| (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
return content
}
, tip: function () {
if (!this.$tip) {
this.$tip = $(this.options.template)
}
return this.$tip
}
, destroy: function () {
this.hide().$element.off('.' + this.type).removeData(this.type)
}
})
/* POPOVER PLUGIN DEFINITION
* ======================= */
$.fn.popover = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('popover')
, options = typeof option == 'object' && option
if (!data) $this.data('popover', (data = new Popover(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.popover.Constructor = Popover
$.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
placement: 'right'
, trigger: 'click'
, content: ''
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
})
}(window.jQuery);

View File

@ -0,0 +1,151 @@
/* =============================================================
* bootstrap-scrollspy.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#scrollspy
* =============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================== */
!function ($) {
"use strict"; // jshint ;_;
/* SCROLLSPY CLASS DEFINITION
* ========================== */
function ScrollSpy(element, options) {
var process = $.proxy(this.process, this)
, $element = $(element).is('body') ? $(window) : $(element)
, href
this.options = $.extend({}, $.fn.scrollspy.defaults, options)
this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process)
this.selector = (this.options.target
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|| '') + ' .nav li > a'
this.$body = $('body')
this.refresh()
this.process()
}
ScrollSpy.prototype = {
constructor: ScrollSpy
, refresh: function () {
var self = this
, $targets
this.offsets = $([])
this.targets = $([])
$targets = this.$body
.find(this.selector)
.map(function () {
var $el = $(this)
, href = $el.data('target') || $el.attr('href')
, $href = /^#\w/.test(href) && $(href)
return ( $href
&& $href.length
&& [[ $href.position().top, href ]] ) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
self.offsets.push(this[0])
self.targets.push(this[1])
})
}
, process: function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
, scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
, maxScroll = scrollHeight - this.$scrollElement.height()
, offsets = this.offsets
, targets = this.targets
, activeTarget = this.activeTarget
, i
if (scrollTop >= maxScroll) {
return activeTarget != (i = targets.last()[0])
&& this.activate ( i )
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
&& this.activate( targets[i] )
}
}
, activate: function (target) {
var active
, selector
this.activeTarget = target
$(this.selector)
.parent('.active')
.removeClass('active')
selector = this.selector
+ '[data-target="' + target + '"],'
+ this.selector + '[href="' + target + '"]'
active = $(selector)
.parent('li')
.addClass('active')
if (active.parent('.dropdown-menu').length) {
active = active.closest('li.dropdown').addClass('active')
}
active.trigger('activate')
}
}
/* SCROLLSPY PLUGIN DEFINITION
* =========================== */
$.fn.scrollspy = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('scrollspy')
, options = typeof option == 'object' && option
if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.scrollspy.Constructor = ScrollSpy
$.fn.scrollspy.defaults = {
offset: 10
}
/* SCROLLSPY DATA-API
* ================== */
$(window).on('load', function () {
$('[data-spy="scroll"]').each(function () {
var $spy = $(this)
$spy.scrollspy($spy.data())
})
})
}(window.jQuery);

View File

@ -0,0 +1,133 @@
/* ========================================================
* bootstrap-tab.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#tabs
* ========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================== */
!function ($) {
"use strict"; // jshint ;_;
/* TAB CLASS DEFINITION
* ==================== */
var Tab = function (element) {
this.element = $(element)
}
Tab.prototype = {
constructor: Tab
, show: function () {
var $this = this.element
, $ul = $this.closest('ul:not(.dropdown-menu)')
, selector = $this.attr('data-target')
, previous
, $target
, e
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
if ( $this.parent('li').hasClass('active') ) return
previous = $ul.find('.active:last a')[0]
e = $.Event('show', {
relatedTarget: previous
})
$this.trigger(e)
if (e.isDefaultPrevented()) return
$target = $(selector)
this.activate($this.parent('li'), $ul)
this.activate($target, $target.parent(), function () {
$this.trigger({
type: 'shown'
, relatedTarget: previous
})
})
}
, activate: function ( element, container, callback) {
var $active = container.find('> .active')
, transition = callback
&& $.support.transition
&& $active.hasClass('fade')
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
element.addClass('active')
if (transition) {
element[0].offsetWidth // reflow for transition
element.addClass('in')
} else {
element.removeClass('fade')
}
if ( element.parent('.dropdown-menu') ) {
element.closest('li.dropdown').addClass('active')
}
callback && callback()
}
transition ?
$active.one($.support.transition.end, next) :
next()
$active.removeClass('in')
}
}
/* TAB PLUGIN DEFINITION
* ===================== */
$.fn.tab = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('tab')
if (!data) $this.data('tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}
$.fn.tab.Constructor = Tab
/* TAB DATA-API
* ============ */
$(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
e.preventDefault()
$(this).tab('show')
})
}(window.jQuery);

View File

@ -0,0 +1,276 @@
/* ===========================================================
* bootstrap-tooltip.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#tooltips
* Inspired by the original jQuery.tipsy by Jason Frame
* ===========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
!function ($) {
"use strict"; // jshint ;_;
/* TOOLTIP PUBLIC CLASS DEFINITION
* =============================== */
var Tooltip = function (element, options) {
this.init('tooltip', element, options)
}
Tooltip.prototype = {
constructor: Tooltip
, init: function (type, element, options) {
var eventIn
, eventOut
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
this.enabled = true
if (this.options.trigger == 'click') {
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
} else if (this.options.trigger != 'manual') {
eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
, getOptions: function (options) {
options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay
, hide: options.delay
}
}
return options
}
, enter: function (e) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
if (!self.options.delay || !self.options.delay.show) return self.show()
clearTimeout(this.timeout)
self.hoverState = 'in'
this.timeout = setTimeout(function() {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
, leave: function (e) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
if (this.timeout) clearTimeout(this.timeout)
if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.hoverState = 'out'
this.timeout = setTimeout(function() {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
, show: function () {
var $tip
, inside
, pos
, actualWidth
, actualHeight
, placement
, tp
if (this.hasContent() && this.enabled) {
$tip = this.tip()
this.setContent()
if (this.options.animation) {
$tip.addClass('fade')
}
placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
inside = /in/.test(placement)
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.insertAfter(this.$element)
pos = this.getPosition(inside)
actualWidth = $tip[0].offsetWidth
actualHeight = $tip[0].offsetHeight
switch (inside ? placement.split(' ')[1] : placement) {
case 'bottom':
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
break
case 'top':
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
break
case 'left':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
break
case 'right':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
break
}
$tip
.offset(tp)
.addClass(placement)
.addClass('in')
}
}
, setContent: function () {
var $tip = this.tip()
, title = this.getTitle()
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
$tip.removeClass('fade in top bottom left right')
}
, hide: function () {
var that = this
, $tip = this.tip()
$tip.removeClass('in')
function removeWithAnimation() {
var timeout = setTimeout(function () {
$tip.off($.support.transition.end).detach()
}, 500)
$tip.one($.support.transition.end, function () {
clearTimeout(timeout)
$tip.detach()
})
}
$.support.transition && this.$tip.hasClass('fade') ?
removeWithAnimation() :
$tip.detach()
return this
}
, fixTitle: function () {
var $e = this.$element
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
}
}
, hasContent: function () {
return this.getTitle()
}
, getPosition: function (inside) {
return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
width: this.$element[0].offsetWidth
, height: this.$element[0].offsetHeight
})
}
, getTitle: function () {
var title
, $e = this.$element
, o = this.options
title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
return title
}
, tip: function () {
return this.$tip = this.$tip || $(this.options.template)
}
, validate: function () {
if (!this.$element[0].parentNode) {
this.hide()
this.$element = null
this.options = null
}
}
, enable: function () {
this.enabled = true
}
, disable: function () {
this.enabled = false
}
, toggleEnabled: function () {
this.enabled = !this.enabled
}
, toggle: function (e) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
self[self.tip().hasClass('in') ? 'hide' : 'show']()
}
, destroy: function () {
this.hide().$element.off('.' + this.type).removeData(this.type)
}
}
/* TOOLTIP PLUGIN DEFINITION
* ========================= */
$.fn.tooltip = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('tooltip')
, options = typeof option == 'object' && option
if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.tooltip.Constructor = Tooltip
$.fn.tooltip.defaults = {
animation: true
, placement: 'top'
, selector: false
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
, trigger: 'hover'
, title: ''
, delay: 0
, html: false
}
}(window.jQuery);

View File

@ -0,0 +1,60 @@
/* ===================================================
* bootstrap-transition.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#transitions
* ===================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
!function ($) {
"use strict"; // jshint ;_;
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */
$(function () {
$.support.transition = (function () {
var transitionEnd = (function () {
var el = document.createElement('bootstrap')
, transEndEventNames = {
'WebkitTransition' : 'webkitTransitionEnd'
, 'MozTransition' : 'transitionend'
, 'OTransition' : 'oTransitionEnd otransitionend'
, 'transition' : 'transitionend'
}
, name
for (name in transEndEventNames){
if (el.style[name] !== undefined) {
return transEndEventNames[name]
}
}
}())
return transitionEnd && {
end: transitionEnd
}
})()
})
}(window.jQuery);

View File

@ -0,0 +1,310 @@
/* =============================================================
* bootstrap-typeahead.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#typeahead
* =============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */
!function($){
"use strict"; // jshint ;_;
/* TYPEAHEAD PUBLIC CLASS DEFINITION
* ================================= */
var Typeahead = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.typeahead.defaults, options)
this.matcher = this.options.matcher || this.matcher
this.sorter = this.options.sorter || this.sorter
this.highlighter = this.options.highlighter || this.highlighter
this.updater = this.options.updater || this.updater
this.$menu = $(this.options.menu).appendTo('body')
this.source = this.options.source
this.shown = false
this.listen()
}
Typeahead.prototype = {
constructor: Typeahead
, select: function () {
var val = this.$menu.find('.active').attr('data-value')
this.$element
.val(this.updater(val))
.change()
return this.hide()
}
, updater: function (item) {
return item
}
, show: function () {
var pos = $.extend({}, this.$element.offset(), {
height: this.$element[0].offsetHeight
})
this.$menu.css({
top: pos.top + pos.height
, left: pos.left
})
this.$menu.show()
this.shown = true
return this
}
, hide: function () {
this.$menu.hide()
this.shown = false
return this
}
, lookup: function (event) {
var items
this.query = this.$element.val()
if (!this.query || this.query.length < this.options.minLength) {
return this.shown ? this.hide() : this
}
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
return items ? this.process(items) : this
}
, process: function (items) {
var that = this
items = $.grep(items, function (item) {
return that.matcher(item)
})
items = this.sorter(items)
if (!items.length) {
return this.shown ? this.hide() : this
}
return this.render(items.slice(0, this.options.items)).show()
}
, matcher: function (item) {
return ~item.toLowerCase().indexOf(this.query.toLowerCase())
}
, sorter: function (items) {
var beginswith = []
, caseSensitive = []
, caseInsensitive = []
, item
while (item = items.shift()) {
if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
else if (~item.indexOf(this.query)) caseSensitive.push(item)
else caseInsensitive.push(item)
}
return beginswith.concat(caseSensitive, caseInsensitive)
}
, highlighter: function (item) {
var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
return '<strong>' + match + '</strong>'
})
}
, render: function (items) {
var that = this
items = $(items).map(function (i, item) {
i = $(that.options.item).attr('data-value', item)
i.find('a').html(that.highlighter(item))
return i[0]
})
items.first().addClass('active')
this.$menu.html(items)
return this
}
, next: function (event) {
var active = this.$menu.find('.active').removeClass('active')
, next = active.next()
if (!next.length) {
next = $(this.$menu.find('li')[0])
}
next.addClass('active')
}
, prev: function (event) {
var active = this.$menu.find('.active').removeClass('active')
, prev = active.prev()
if (!prev.length) {
prev = this.$menu.find('li').last()
}
prev.addClass('active')
}
, listen: function () {
this.$element
.on('blur', $.proxy(this.blur, this))
.on('keypress', $.proxy(this.keypress, this))
.on('keyup', $.proxy(this.keyup, this))
if (this.eventSupported('keydown')) {
this.$element.on('keydown', $.proxy(this.keydown, this))
}
this.$menu
.on('click', $.proxy(this.click, this))
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
}
, eventSupported: function(eventName) {
var isSupported = eventName in this.$element
if (!isSupported) {
this.$element.setAttribute(eventName, 'return;')
isSupported = typeof this.$element[eventName] === 'function'
}
return isSupported
}
, move: function (e) {
if (!this.shown) return
switch(e.keyCode) {
case 9: // tab
case 13: // enter
case 27: // escape
e.preventDefault()
break
case 38: // up arrow
e.preventDefault()
this.prev()
break
case 40: // down arrow
e.preventDefault()
this.next()
break
}
e.stopPropagation()
}
, keydown: function (e) {
this.suppressKeyPressRepeat = !~$.inArray(e.keyCode, [40,38,9,13,27])
this.move(e)
}
, keypress: function (e) {
if (this.suppressKeyPressRepeat) return
this.move(e)
}
, keyup: function (e) {
switch(e.keyCode) {
case 40: // down arrow
case 38: // up arrow
case 16: // shift
case 17: // ctrl
case 18: // alt
break
case 9: // tab
case 13: // enter
if (!this.shown) return
this.select()
break
case 27: // escape
if (!this.shown) return
this.hide()
break
default:
this.lookup()
}
e.stopPropagation()
e.preventDefault()
}
, blur: function (e) {
var that = this
setTimeout(function () { that.hide() }, 150)
}
, click: function (e) {
e.stopPropagation()
e.preventDefault()
this.select()
}
, mouseenter: function (e) {
this.$menu.find('.active').removeClass('active')
$(e.currentTarget).addClass('active')
}
}
/* TYPEAHEAD PLUGIN DEFINITION
* =========================== */
$.fn.typeahead = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('typeahead')
, options = typeof option == 'object' && option
if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.typeahead.defaults = {
source: []
, items: 8
, menu: '<ul class="typeahead dropdown-menu"></ul>'
, item: '<li><a href="#"></a></li>'
, minLength: 1
}
$.fn.typeahead.Constructor = Typeahead
/* TYPEAHEAD DATA-API
* ================== */
$(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
var $this = $(this)
if ($this.data('typeahead')) return
e.preventDefault()
$this.typeahead($this.data())
})
}(window.jQuery);

2025
hlr_mgmt/static/bootstrap/js/bootstrap.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,30 @@
.com { color: #93a1a1; }
.lit { color: #195f91; }
.pun, .opn, .clo { color: #93a1a1; }
.fun { color: #dc322f; }
.str, .atv { color: #D14; }
.kwd, .prettyprint .tag { color: #1e347b; }
.typ, .atn, .dec, .var { color: teal; }
.pln { color: #48484c; }
.prettyprint {
padding: 8px;
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
}
.prettyprint.linenums {
-webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
-moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin: 0 0 0 33px; /* IE indents via margin-left */
}
ol.linenums li {
padding-left: 12px;
color: #bebec5;
line-height: 20px;
text-shadow: 0 1px 0 #fff;
}

View File

@ -0,0 +1,28 @@
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

51
hlr_mgmt/static/style.css Normal file
View File

@ -0,0 +1,51 @@
/*table formatting*/
.border-bottom {
border-bottom: solid 1px black;
border-top: solid 1px black;
}
table.table thead .sorting,
table.table thead .sorting_asc,
table.table thead .sorting_desc,
table.table thead .sorting_asc_disabled,
table.table thead .sorting_desc_disabled {
cursor: pointer;
*cursor: hand;
}
table.table thead .sorting { background: url('images/sort_both.png') no-repeat center right; }
table.table thead .sorting_asc { background: url('images/sort_asc.png') no-repeat center right; }
table.table thead .sorting_desc { background: url('images/sort_desc.png') no-repeat center right; }
table.table thead .sorting_asc_disabled { background: url('images/sort_asc_disabled.png') no-repeat center right; }
table.table thead .sorting_desc_disabled { background: url('images/sort_desc_disabled.png') no-repeat center right; }
/*Sidebar fix*/
.bs-docs-sidenav {
width: 200px;
}
/*FOKUS Color Scheme*/
h1 {
color: #009473
}
h2 {
color: #009473
}
a {
color: #00509D;
}
.nav-list a {
color: #009473;
}
.nav-list .active a {
background-color: #009473;
}
.nav-list .active a:hover {
background-color: #009473;
}

152
hlr_mgmt/telnet_backend.py Normal file
View File

@ -0,0 +1,152 @@
#!/usr/bin/python
###
# Copyright (C) 2013
# Fraunhofer Institute for Open Communication Systems (FOKUS)
# Competence Center NETwork research (NET), St. Augustin, GERMANY
# Alton MacDonald <alton.kenneth.macdonald@fokus.fraunhofer.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###
import telnetlib, logging, collections
log = logging.getLogger(__name__)
class telnet_backend(object):
## Initialization and Settings ##
def __init__(self, ip, port):
self.ip = ip
self.port = port
self.conn = None
self.connected = False
self.sms_limit = 160
## Common Commands ##
def connect(self):
try:
self.conn = telnetlib.Telnet(self.ip, self.port)
self.conn.read_until("> ")
self.conn.write("enable\n")
self.conn.read_until("# ")
self.connected = True
return True
except:
return False
def close(self):
try:
self.conn.write("exit")
self.conn.close()
self.connected = False
return True
except:
return False
def execute(self, cmd):
try:
self.conn.write(cmd+"\n")
result = self.conn.read_until("# ")
result = result[len(cmd)+1:-10]
return self.sanitize_telnet(result)
except:
return None
def save_config(self):
try:
self.execute('copy running-config startup-config')
return True
except:
return False
def sanitize_telnet(self, input):
output = input.decode('utf_8')
output = ' '.join(output.split(' '))
return output.split("\r\n")
def get_version(self):
return self.execute("show version")
## OpenBSC Commands ##
def send_sms(self, src, dest, text):
sms_cmd = "subscriber extension " + str(dest) + " sms sender extension " + str(src) + " send "
self.execute(sms_cmd + text[:self.sms_limit])
def send_welcome_sms(self, provider, ext):
log.debug("sending welcome message to Extension: " + str(ext))
sms_string = "Welcome to " + provider + ". Your Local Number is " + str(ext) + "."
self.send_sms(ext,ext,sms_string)
sms_string = "To call other " + provider + " customers use their 5 digit extention. Otherwise, please dial the number normally."
self.send_sms(ext,ext,sms_string)
def configure_timeslot(self, bts, timeslot, config):
self.execute('configure terminal')
self.execute('network')
self.execute('bts ' + bts)
self.execute('trx 0')
self.execute('timeslot ' + timeslot)
self.execute('phys_chan_config ' + config)
self.execute('end')
return self.save_config()
def get_network_info(self):
return self.execute("show network")
def get_network_statistics(self):
return self.execute("show statistics")
def get_bts_info(self, bts):
return self.execute("show bts " + bts)
def get_timeslot_info(self, bts, timeslot):
return self.execute("show timeslot " + bts + " 0 " + timeslot)
## OpenSGSN Commands ##
def get_mm_context(self, imsi):
return self.execute('show mm-context imsi ' + imsi)
def get_ns_stats(self):
return self.execute('show ns stats')[:-1]
def get_nsei_info(self,nsei):
return self.execute('show ns nsei ' + nsei + ' stats')
def get_bssgp_stats(self):
bad_output = self.execute('show bssgp stats')
fixed_output = list()
final_output = collections.defaultdict()
for row in bad_output:
if row.find("\n")<0:
fixed_output.append(row)
else:
fixed_output.append(row.split("\n")[0])
fixed_output.append(row.split("\n")[1])
fixed_output[1:] = fixed_output[1:]
active = False
for row in range(0,len(fixed_output)):
if fixed_output[row].find("NSEI")>=0:
if not fixed_output[row][fixed_output[row].find("RA-ID: ")+7]=="0":
CID = str(fixed_output[row][fixed_output[row].find("CID: ")+5:fixed_output[row].rfind(",")])
final_output[CID] = list()
active = True
else:
active = False
if active:
final_output[CID].append(fixed_output[row])
return final_output

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
<%inherit file="layout.mako"/>
<%namespace name="table_iterator" file="table_iterator.mako"/>
<div class="page-header">
<h2>BSC Information and Statistics</h2>
</div>
<h3>Version</h3>
% if bsc_version:
${table_iterator.version(bsc_version)}
% endif
<h3>Network</h3>
% if bsc_network:
${table_iterator.iterate(bsc_network)}
% endif
<h3>Statistics</h3>
% if bsc_statistics:
${table_iterator.iterate(bsc_statistics)}
% endif

132
hlr_mgmt/templates/bts.mako Normal file
View File

@ -0,0 +1,132 @@
# -*- coding: utf-8 -*-
<%inherit file="layout.mako"/>
<%namespace name="table_iterator" file="table_iterator.mako"/>
<div class="page-header">
<h2>BTS Detailed Information</h2>
% if bts:
<h4>Number of Deployed BTS: ${len(bts)}</h4>
% endif
</div>
% if bts and phys_cfg:
<ul class="nav nav-tabs">
% for i in range(0,len(bts)):
% if bts[i].has_key('ip'):
<li><a href="#bts_${i}" data-toggle="tab"><h5><span class="badge badge-success"><i class="icon-map-marker icon-white"></span></i> BTS ${i}</h5></a></li>
% else:
<li><a href="#bts_${i}" data-toggle="tab"><h5><span class="badge badge-warning"><i class="icon-warning-sign icon-white"></span></i> BTS ${i}</h5></a></li>
% endif
% endfor
</ul>
<div class="tab-content">
% for i in range(0,len(bts)):
% if i==0:
<div class="tab-pane" id="bts_${i}">
% else:
<div class="tab-pane" id="bts_${i}">
% endif
<h3>BTS ${i}
% if bts[i].has_key('ip'):
(${bts[i]['ip']})
% else:
(not connected)
% endif
<br/>${bts[i]['description']}
</h3>
${table_iterator.iterate(bts[i]['stats'])}
<h3>Channel Details</h3>
<div class="alert alert-error" hidden></div>
<div class="alert alert-success" hidden></div>
<table class="table table-hover table-condensed">
<thead>
<tr>
<th>phys cfg</th>
<th>TSC</th>
<th>NM State</th>
<th>Admin</th>
<th>Avail</th>
</tr>
</thead>
<tbody>
% for j in range(0,len(bts[i]['timeslots'])):
<tr>
% for detail in bts[i]['timeslots'][j]:
% if detail.find("phys")>=0:
<td><select onChange="toggle_channel(${i},${j})" id="config_${i}_${j}">
% for setting in phys_cfg:
% if setting==detail.split(": ")[1]:
<option selected value="${setting}">${setting}</option>
% else:
<option value="${setting}">${setting}</option>
% endif
% endfor
</select></td>
% else:
% if detail.find(": ")>0:
<td>${detail.split(": ")[1]}</td>
% else:
<td>${' '.join(detail.split()[1:])}</td>
% endif
% endif
% endfor
</tr>
% endfor
</tbody>
</table>
<br/>
% if bts[i].has_key('bssgp'):
<h3>BSSGP Data Connection Details</h3>
${table_iterator.iterate(bts[i]['bssgp'])}
</br><h3>NSEI Data Connection Details</h3>
${table_iterator.iterate(bts[i]['nsei'][:-1])}
</br>
% endif
</div>
% endfor
</div>
</ul>
% else:
<h4>No BTS deployed</h4>
% endif
<script>
function linkedTab()
{
//function which handles linking to tabular content
hash = location.hash
hash = hash.split('?')[0]
activeTab = $('[href=' + hash + ']');
activeTab.tab('show');
}
linkedTab();
function toggle_channel(bts_id,channel)
{
var modified = document.getElementById("config_"+bts_id+"_"+channel);
var config = modified.options[modified.selectedIndex].text;
var url = '${request.route_url('toggle_channel',bts_id='bts_id',channel='channel')}';
url = url.replace('bts_id',bts_id);
url = url.replace('channel',channel);
url = url + "?config=" + config
$.ajax({
url: url,
success: function(){
$(".alert-success").append("<strong>SUCCESS:</strong> BTS " + bts_id + " successfully changed configuration for channel " + channel + " to " + config + "<br/>");
$(".alert-success").show();
setTimeout("close_alerts()",5000);
},
error: function(){
$(".alert-error").append("<strong>ERROR:</strong> BTS " + bts_id + " was not able to change the configuration for channel " + channel + " to " + config + "<br/>");
$(".alert-error").show();
setTimeout("close_alerts()",5000);
}
});
}
$('select').tooltip({
placement: "left",
title: "Select desired channel configuration"
});
</script>

View File

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
<%inherit file="layout.mako"/>
<div class="page-header">
<h2>OpenBSC and OsmoSGSN HLR Management Interface</h2>
</div>
<div class="hero-unit">
<p style="color:#00509D">
Easily administer your OpenBSC and OsmoSGSN based GSM network.<br>
You can:<br>
* View network performance statistics<br>
* Administer subscribers<br>
* Change the antenna timeslot settings to accomodate for user Voice and Data Traffic
</p>
</div>
<br/>
Copyright &copy; 2013<br/>
Fraunhofer Institute for Open Communication Systems (FOKUS)<br/>
Competence Center NETwork research (NET), St. Augustin, GERMANY<br/>
Interface by <a href="mailto:alton.kenneth.macdoald@fokus.fraunhofer.de">Alton MacDonald</a><br/>

View File

@ -0,0 +1,121 @@
# -*- coding: utf-8 -*-
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>OpenBSC and OsmoSGSN HLR Management Interface</title>
<link rel="shortcut icon" href="/static/images/favicon.ico" />
<link rel="stylesheet" href="/static/bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="/static/bootstrap/css/bootstrap-responsive.css">
<link rel="stylesheet" href="/static/bootstrap/css/docs.css">
<link rel="stylesheet" href="/static/bootstrap-editable/css/bootstrap-editable.css">
<link rel="stylesheet" href="/static/DataTables/DT_bootstrap.css">
<link rel="stylesheet" href="/static/style.css">
<script src="/static/bootstrap/js/jquery.js"></script>
<script src="/static/bootstrap/js/bootstrap-transition.js"></script>
<script src="/static/bootstrap/js/bootstrap-alert.js"></script>
<script src="/static/bootstrap/js/bootstrap-modal.js"></script>
<script src="/static/bootstrap/js/bootstrap-dropdown.js"></script>
<script src="/static/bootstrap/js/bootstrap-scrollspy.js"></script>
<script src="/static/bootstrap/js/bootstrap-tab.js"></script>
<script src="/static/bootstrap/js/bootstrap-tooltip.js"></script>
<script src="/static/bootstrap/js/bootstrap-popover.js"></script>
<script src="/static/bootstrap/js/bootstrap-button.js"></script>
<script src="/static/bootstrap/js/bootstrap-collapse.js"></script>
<script src="/static/bootstrap/js/bootstrap-carousel.js"></script>
<script src="/static/bootstrap/js/bootstrap-typeahead.js"></script>
<script src="/static/bootstrap-editable/js/bootstrap-editable.js"></script>
<script src="/static/DataTables/jquery.dataTables.js"></script>
<script src="/static/DataTables/DT_bootstrap.js"></script>
</head>
<body>
<div class="fluid-container">
<div class="fluid-row">
<div class="span2 affix" style="height:100%;">
<a href="http://www.fokus.fraunhofer.de/de/rescon/index.html">
<img src="/static/images/FOKUS.png">
</a>
<ul class="nav nav-list bs-docs-sidenav">
% if request.path=="/":
<li class="active">
<a href="/"><i class="icon-home icon-white">
% else:
<li>
<a href="/"><i class="icon-home icon">
% endif
</i> Home <i class="icon-chevron-right"></i></a></li>
% if request.path.find("/bsc/")==0:
<li class="active">
<a href="/bsc/"><i class="icon-signal icon-white">
% else:
<li>
<a href="/bsc/"><i class="icon-signal icon">
% endif
</i> BSC Stats <i class="icon-chevron-right"></i></a></li>
% if request.path.find("/sgsn/")==0:
<li class="active">
<a href="/sgsn/"><i class="icon-globe icon-white">
% else:
<li>
<a href="/sgsn/"><i class="icon-globe icon">
% endif
</i> SGSN Stats <i class="icon-chevron-right"></i></a></li>
% if request.path.find("/bts/")==0:
<li class="active">
<a href="/bts/"><i class="icon-road icon-white">
% else:
<li>
<a href="/bts/"><i class="icon-road icon">
% endif
</i> BTS Config <i class="icon-chevron-right"></i></a></li>
% if request.path.find("/subscribers/")==0:
<li class="active">
<a href="/subscribers/"><i class="icon-user icon-white">
% else:
<li>
<a href="/subscribers/"><i class="icon-user icon">
% endif
</i> Subscribers <i class="icon-chevron-right"></i></a></li>
% if request.path.find("/sms/")==0:
<li class="active">
<a href="/sms/"><i class="icon-envelope icon-white">
% else:
<li>
<a href="/sms/"><i class="icon-envelope icon">
% endif
</i> SMS <i class="icon-chevron-right"></i></a></li>
% if request.path.find("/scripts/")==0:
<li class="active">
<a href="/scripts/"><i class="icon-cog icon-white">
% else:
<li>
<a href="/scripts/"><i class="icon-cog icon">
% endif
</i> Mgmt Scripts <i class="icon-chevron-right"></i></a></li>
</ul><!--nav-->
<div style="position: absolute; bottom: 100px; left: 0;">
<a id="logo" href="http://openbsc.osmocom.org/"><img src="http://bb.osmocom.org/osmocom/osmocom_logo.png" style="width:170px"/></a>
</div>
</div><!--span2-->
<div class="span10 offset2" style="padding-bottom:35px">
<script>
function close_alerts()
{
$(".alert").html("")
$(".alert").hide()
}
</script>
${next.body()}
</div>
<div class="navbar-fixed-bottom" style="background:#009473">
<div class="pull-right"><a href="http://www.pylonsproject.org/"><img src="http://docs.pylonsproject.org/projects/pyramid_tutorials/en/latest/_static/pyramid-small.png" style="height:30px"/></a></div>
<center><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" style="height:30px"/></a></center>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
<%inherit file="layout.mako"/>
<div id="notfound">
<h1>404 - PAGE NOT FOUND</h1>
The page you're looking for isn't here.
</div>

View File

@ -0,0 +1,167 @@
# -*- coding: utf-8 -*-
<%inherit file="layout.mako"/>
<div class="page-header">
<h2>Management Scripts</h2>
</div>
<h3>Register IMSI through IMEI Lookup</h3>
<h4>This script will lookup the phone with the IMEI provided and authorize its active IMSI (SIM Card) for access</h4>
<form action="javascript:authorize_imei();" id="imei_form">
<fieldset>
<span class="help-block">Dial *#06# on the Target Phone to obtain its IMEI. Then enter the IMEI below.</span>
<div class="span7">
<input type="text" placeholder="15 digit IMEI..." name="imei">
<button type="submit" class="btn btn-info pull-right">Queue Authorization</button>
</div>
</fieldset>
</form>
<div class="alert alert-error" hidden></div>
<div class="alert alert-success" hidden></div>
<br/><br/>
<h3>Running Services</h3>
<table class="table table-bordered table-hover" id="scripts_table">
<thead>
<tr><th> Service </th>
<th> Status </th>
<th> Actions </th>
</tr>
</thead>
<tbody>
<tr><td>LCR</td>
% if service_status['lcr']:
% if service_status['lcr'].find("running")>0:
<td><span class="label label-success">Running</span></td>
% else:
<td><span class="label label-important">Stopped</span></td>
% endif
% else:
<td><span class="label label-warning">ERROR</span></td>
% endif
<td>
<start><a href="${request.route_url('manage_service', service='lcr', action=1)}"><span class="badge badge-success"><i class="icon-play icon-white"></i></span></a></start>
<reload><a href="${request.route_url('manage_service', service='lcr', action=2)}"><span class="badge badge-info"><i class="icon-repeat icon-white"></i></span></a></reload>
<stop><a href="${request.route_url('manage_service', service='lcr', action=3)}"><span class="badge badge-important"><i class="icon-pause icon-white"></i></span></a></stop>
</td></tr>
<tr><td>Asterisk</td>
% if service_status['asterisk']:
% if service_status['asterisk'].find("failed")<0:
<td><span class="label label-success">Running</span></td>
% else:
<td><span class="label label-important">Stopped</span></td>
% endif
% else:
<td><span class="label label-warning">ERROR</span></td>
% endif
<td>
<start><a href="${request.route_url('manage_service', service='asterisk', action=1)}"><span class="badge badge-success"><i class="icon-play icon-white"></i></span></a></start>
<reload><a href="${request.route_url('manage_service', service='asterisk', action=2)}"><span class="badge badge-info"><i class="icon-repeat icon-white"></i></span></a></reload>
<stop><a href="${request.route_url('manage_service', service='asterisk', action=3)}"><span class="badge badge-important"><i class="icon-pause icon-white"></i></span></a></stop>
</td></tr>
<tr><td>GGSN</td>
% if service_status['ggsn']:
% if service_status['ggsn'].find("failed")<0:
<td><span class="label label-success">Running</span></td>
% else:
<td><span class="label label-important">Stopped</span></td>
% endif
% else:
<td><span class="label label-warning">ERROR</span></td>
% endif
<td>
<start><a href="${request.route_url('manage_service', service='ggsn', action=1)}"><span class="badge badge-success"><i class="icon-play icon-white"></i></span></a></start>
<reload><a href="${request.route_url('manage_service', service='ggsn', action=2)}"><span class="badge badge-info"><i class="icon-repeat icon-white"></i></span></a></reload>
<stop><a href="${request.route_url('manage_service', service='ggsn', action=3)}"><span class="badge badge-important"><i class="icon-pause icon-white"></i></span></a></stop>
</td></tr>
<tr><td>OpenBSC</td>
% if service_status['nitb']:
% if service_status['nitb'].find("failed")<0:
<td><span class="label label-success">Running</span></td>
% else:
<td><span class="label label-important">Stopped</span></td>
% endif
% else:
<td><span class="label label-warning">ERROR</span></td>
% endif
<td>
<start><a href="${request.route_url('manage_service', service='nitb', action=1)}"><span class="badge badge-success"><i class="icon-play icon-white"></i></span></a></start>
<reload><a href="${request.route_url('manage_service', service='nitb', action=2)}"><span class="badge badge-info"><i class="icon-repeat icon-white"></i></span></a></reload>
<stop><a href="${request.route_url('manage_service', service='nitb', action=3)}"><span class="badge badge-important"><i class="icon-pause icon-white"></i></span></a></stop>
</td></tr>
<tr><td>OsmoSGSN</td>
% if service_status['sgsn']:
% if service_status['sgsn'].find("failed")<0:
<td><span class="label label-success">Running</span></td>
% else:
<td><span class="label label-important">Stopped</span></td>
% endif
% else:
<td><span class="label label-warning">ERROR</span></td>
% endif
<td>
<start><a href="${request.route_url('manage_service', service='sgsn', action=1)}"><span class="badge badge-success"><i class="icon-play icon-white"></i></span></a></start>
<reload><a href="${request.route_url('manage_service', service='sgsn', action=2)}"><span class="badge badge-info"><i class="icon-repeat icon-white"></i></span></a></reload>
<stop><a href="${request.route_url('manage_service', service='sgsn', action=3)}"><span class="badge badge-important"><i class="icon-pause icon-white"></i></span></a></stop>
</td></tr>
<tr><td><strong><em>SubscriberMonitor</em></strong></td>
% if service_status['subMonitor']:
% if service_status['subMonitor']==True:
<td><span class="label label-success">Running</span></td>
% else:
<td><span class="label label-important">Stopped</span></td>
% endif
% else:
<td><span class="label label-warning">ERROR</span></td>
% endif
<td>
<start><a href="${request.route_url('manage_service', service='subMonitor', action=1)}"><span class="badge badge-success"><i class="icon-play icon-white"></i></span></a></start>
<reload><a href="${request.route_url('manage_service', service='subMonitor', action=2)}"><span class="badge badge-info"><i class="icon-repeat icon-white"></i></span></a></reload>
<stop><a href="${request.route_url('manage_service', service='subMonitor', action=3)}"><span class="badge badge-important"><i class="icon-pause icon-white"></i></span></a></stop>
</td></tr>
</tbody>
</table>
<script>
function authorize_imei()
{
url = "${request.route_url('authorize_imei',imei='000000000000000')}";
form_input = $('#imei_form :input');
imei = form_input.val()
url = url.replace("000000000000000",imei)
$.ajax({
url: url,
success: function(data){
switch(data.success)
{
case 1:
$(".alert-success").append("<strong>SUCCESS:</strong> Registration of SIM card in device with IMEI:" + imei + " queued!<br/>");
$(".alert-success").show();
break;
case 0:
$(".alert-error").append("<strong>Invalid IMEI:</strong> IMEI:" + imei + " has incorrect FORMAT<br/>");
case -1:
$(".alert-error").append("<strong>Invalid IMEI:</strong> IMEI:" + imei + " has incorrect LENGTH<br/>");
case -2:
$(".alert-error").append("<strong>Invalid IMEI:</strong> IMEI:" + imei + " has incorrect CHECKSUM DIGIT<br/>");
$(".alert-error").show();
default:
break;
}
setTimeout("close_alerts()",5000);
}
})
}
$("#scripts_table start").tooltip({
title: 'Click to Start',
placement: 'right'
});
$("#scripts_table stop").tooltip({
title: 'Click to Stop',
placement: 'right'
});
$("#scripts_table reload").tooltip({
title: 'Click to Reload',
placement: 'right'
});
</script>

View File

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
<%inherit file="layout.mako"/>
<%namespace name="table_iterator" file="table_iterator.mako"/>
<div class="page-header">
<h2>SGSN Information and Statistics</h2>
</div>
<h3>Version</h3>
% if sgsn_version:
${table_iterator.version(sgsn_version)}
% endif
<h3>NS Statistics</h3>
% if ns_statistics:
${table_iterator.iterate(ns_statistics, keyword="Encapsulation", keyword_border=False)}
% endif

View File

@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
<%inherit file="layout.mako"/>
<div class="page-header">
<h2>SMS</h2>
</div>
<h3>Broadcast SMS</h3>
<h5>* Messages are automatically truncated at 160 characters!</h5>
<form action="${request.route_url('broadcast_sms')}">
<fieldset>
<textarea class="span10" placeholder="write a message..." name="text"></textarea>
<button type="submit" class="btn btn-info pull-right">Send Broadcast SMS</button>
</fieldset>
</form>
<a href="${request.route_url('clear_sms')}" class="btn btn-danger">Clear SMS History</a>
<br/><br/>
<h3>History</h3>
<table class="table table-bordered table-hover">
<thead>
<tr><th> ID </th>
<th> From </th>
<th> To </th>
<th> Sent </th>
<th> Delivered </th>
<th> Message </th>
<th> Actions </th>
</tr>
</thead>
<tbody>
% if sms:
% for msg in sms:
<tr>
<td>${msg['id']}</td>
<td><a href="${request.route_url('subscriber_detail', extension=msg['from_id'])}">${msg['from_id']}</a></td>
<td><a href="${request.route_url('subscriber_detail', extension=msg['to_id'])}">${msg['to_id']}</a></td>
<td>${msg['sent']}</td>
<td>${msg['delivered']}</td>
<td>${msg['message']}</td>
<td><a href="${request.route_url('delete_sms', id=msg['id'])}">Delete</a></td>
</tr>
% endfor
% endif
<tbody>
</table>

View File

@ -0,0 +1,74 @@
# -*- coding: utf-8 -*-
<%inherit file="layout.mako"/>
<%namespace name="table_iterator" file="table_iterator.mako"/>
% if extension>=20000 and extension<=49999:
<h2>Subscriber Extension: ${extension}</h2>
<h3>Used by Handsets with IMEI:</h3>
<h5>* IMEI values are stored in the database without the checksum digit. (i.e. it replaces the last digit shown here with 0)</h5>
<table class="table table-bordered table-hover" id="subscriber_details">
<thead>
<tr><th> IMEI </th>
<th> Equipment Name </th>
<th> Last Used </th>
</tr>
</thead>
<tbody>
% if subscriber:
% for handset in subscriber:
<tr>
<td>${handset['imei']}</td>
<td>
<imei_name data-pk="${handset['imei'][:-1]+'0'}">
% if not handset['name']==None:
${handset['name']}
%endif
</imei_name>
</td>
<td>${handset['updated']}</td>
</tr>
% endfor
% endif
<tbody>
</table>
<h3>Send SMS</h3>
<h5>* Messages are automatically truncated at 160 characters!</h5>
<form action="${request.route_url('send_sms',extension=extension)}">
<fieldset>
<textarea class="span10" placeholder="write a message..." name="text"></textarea>
<button type="submit" class="btn btn-info pull-right">Send</button>
</fieldset>
</form>
% if not mm==None:
% if len(mm)>3:
<h3>Active Data Connection Details:</h3>
${table_iterator.iterate(mm[:-1], keyword="IMSI", subdiv=True)}
% endif
% endif
% else:
<h1>Invalid Extension: ${extension}</h1>
% endif
<script>
$('#subscriber_details imei_name').tooltip({
placement: "right",
title: "Click to Edit this IMEI Name"
});
$('#subscriber_details imei_name').editable({
type: 'text',
placement: 'bottom',
title: 'Edit the name for this IMEI',
emptytext: '____',
url: function(params)
{
$.ajax({
url: '${request.route_url('rename_component',field='imei',value='val',reference='ref')}'.replace('ref/val', params.pk+'/'+params.value)
});
}
});
</script>

View File

@ -0,0 +1,120 @@
# -*- coding: utf-8 -*-
<%inherit file="layout.mako"/>
<div class="page-header">
<h1>Subscribers</h1>
<h3>List of Previously Active Subscribers</h3>
<h4>(does not contain all SIM cards detected by OpenBSC)</h4>
</div>
<div class="alert alert-error" hidden></div>
<div class="alert alert-success" hidden></div>
<table class="table table-bordered table-hover" id="subscribers_table">
<thead>
<tr><th style="padding-right: 20px;"> Extension </th>
<th style="padding-right: 20px;"> SIM Name </th>
<th style="padding-right: 20px;"> Created </th>
<th style="padding-right: 20px;"> IMSI </th>
<th style="padding-right: 20px;"> Country </th>
<th style="padding-right: 20px;"> Operator </th>
<th style="padding-right: 20px;"> TMSI </th>
<th style="padding-right: 20px;"> Attached </th>
<th style="padding-right: 20px;"> Authorized </th>
</tr>
</thead>
<tbody>
% if subscribers:
% for sub in subscribers:
<tr>
<td><extension><a href="${request.route_url('subscriber_detail', extension=sub['ext'])}">${sub['ext']}</a></extension></td>
<td><imsi_name data-pk="${sub['imsi']}">${sub['name']}</imsi_name></td>
<td>${sub['created']}</td>
<td>${sub['imsi']}</td>
% if sub['operator']== None:
<td></td><td></td>
% else:
<td>${sub['operator'][0]}</td><td>${sub['operator'][1]}</td>
% endif
<td>
% if not sub['tmsi']== None:
${hex(int(str(sub['tmsi']),10))}
% endif
</td>
<td>
% if sub['lac'] > 0:
<span class="label label-success">LAC: ${sub['lac']}</span>
% else:
<span class="label">Inactive</span>
% endif
</td>
<td><authorized><a href="javascript:auth_toggle(${sub['ext']});" id="auth_${sub['ext']}"><div class="hidden">
% if sub['authorized']==1:
1</div><span class="badge badge-success"><i class="icon-ok icon-white">
% else:
0</div><span class="badge badge-important"><i class="icon-remove icon-white">
% endif
</i></span></a></authorized></td>
</tr>
% endfor
% endif
</tbody>
</table>
<script>
function auth_toggle(ext) {
url = "${request.route_url('authorize_toggle', extension='ext')}";
url = url.replace('ext',ext);
$.ajax({
url: url,
success: function() {
html = $("#auth_" + ext).html();
if (html.indexOf("1")>0)
auth_html="<div class='hidden'>0</div><span class='badge badge-important'><i class='icon-remove icon-white'></i></span>";
else
auth_html="<div class='hidden'>1</div><span class='badge badge-success'><i class='icon-ok icon-white'></i></span>";
$("#auth_" + ext).html(auth_html);
},
error: function() {
$(".alert-error").append("<strong>ERROR:</strong> Could not change Authorization Status for Extension: " + ext + "<br/>");
$(".alert-error").show();
setTimeout("close_alerts()",5000);
}
})
}
$(document).ready(function() {
$('#subscribers_table').dataTable( {
"sDom": "<'row'<'span5'l><'span5'f>r>t<'row'<'span5'i><'span5'p>>"
} );
} );
$.extend( $.fn.dataTableExt.oStdClasses, {
"sWrapper": "dataTables_wrapper form-inline"
} );
$('#subscribers_table extension').tooltip({
placement: "left",
title: "Click here for Details"
});
$('#subscribers_table authorized').tooltip({
placement: "right",
title: "Click to Toggle Authorization ON or OFF"
});
$('#subscribers_table imsi_name').tooltip({
placement: "right",
title: "Click to Edit this IMSI Name"
});
$('#subscribers_table imsi_name').editable({
type: 'text',
placement: 'bottom',
title: 'Edit the name for this IMSI',
emptytext: '____',
url: function(params)
{
$.ajax({
url: '${request.route_url('rename_component',field='imsi',value='val',reference='ref')}'.replace('ref/val', params.pk+'/'+params.value)
});
}
});
</script>

View File

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
<%def name="version(version_iterable)">
% for entry in version_iterable:
${entry}<br/>
% endfor
</%def>
<%def name="iterate(data, keyword='', keyword_border=True,subdiv=False)">
<table>
% for entry in data:
% if entry.find(keyword)>=0 and len(keyword)>0:
%if keyword_border:
<tr class="border-bottom"><td colspan=2><strong>${entry.strip()}</strong></td></tr>
%else:
<tr><td colspan=2><strong>${entry.strip()}</strong></td></tr>
%endif
% elif len(entry.split(": "))==2 and len(entry.split(":"))==2:
<tr><td><strong>${entry.split(": ")[0]}</strong></td><td>${entry.split(": ")[1]}</td></tr>
% elif subdiv and len(entry.split(": "))>2:
% for detail in entry.split(", "):
<tr><td><strong>${detail.split(": ")[0]}</strong></td><td>${detail.split(": ")[1]}</td></tr>
% endfor
% else :
<tr class="border-bottom"><td colspan=2><strong>${entry.strip()}</strong></td></tr>
% endif
% endfor
</table>
</%def>

414
hlr_mgmt/views.py Normal file
View File

@ -0,0 +1,414 @@
# -*- coding: utf-8 -*-
###
# Copyright (C) 2013
# Fraunhofer Institute for Open Communication Systems (FOKUS)
# Competence Center NETwork research (NET), St. Augustin, GERMANY
# Alton MacDonald <alton.kenneth.macdonald@fokus.fraunhofer.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###
import os, logging
import sqlite3
import collections, csv
import subprocess
from pyramid.config import Configurator
from pyramid.events import NewRequest
from pyramid.events import subscriber
from pyramid.events import ApplicationCreated
from pyramid.httpexceptions import HTTPFound
from pyramid.session import UnencryptedCookieSessionFactoryConfig
from pyramid.view import view_config
from telnet_backend import telnet_backend
from RegisterIMEI import RegisterIMEI
from SubscriberMonitor import SubscriberMonitor
log = logging.getLogger(__name__)
## helper functions ##
def connect_bsc(settings):
bsc = telnet_backend(settings['bsc_ip'], settings['bsc_port'])
bsc.connect()
return bsc
def connect_sgsn(settings):
sgsn = telnet_backend(settings['sgsn_ip'], settings['sgsn_port'])
sgsn.connect()
return sgsn
def db_execute(db, sql_string, params=None):
if params==None:
rs = db.execute(sql_string)
else:
rs = db.execute(sql_string, params)
db.commit()
return rs
def db_query(db, sql_string, params=None):
rs = db_execute(db, sql_string, params)
return rs.fetchall()
def get_subscribers(db):
# lists all subscribers
#sql_string = "select extension, name, created, imsi, tmsi, lac, authorized from subscriber order by extension"
# lists subscribers that at one point have been authorized
#sql_string = "select extension, name, created, imsi, tmsi, lac, authorized from subscriber where not updated=created order by extension"
# lists subscribers optimized for demo purposes
sql_string = "select extension, name, created, imsi, tmsi, lac, authorized from subscriber where not updated=created or updated>date('now','-1 day') order by extension"
return db_query(db,sql_string)
def get_attached_subscribers(db):
sql_string = "select extension from subscriber where lac>0"
return db_query(db,sql_string)
def get_subscriber_detail(db, ext):
sql_string = "select imei,equipment.name,equipmentWatch.updated,imsi from equipment,equipmentwatch,subscriber where equipmentwatch.equipment_id=equipment.id and subscriber.id=equipmentwatch.subscriber_id and extension=? order by equipmentwatch.updated desc"
return db_query(db, sql_string, (ext, ))
def get_sms_senders(db):
sql_string = "select sms.id,subscriber.extension,sms.created,sms.sent,sms.text from sms,subscriber where sms.sender_id=subscriber.id"
return db_query(db, sql_string)
def get_sms_receivers(db):
sql_string = "select sms.id,subscriber.extension from sms,subscriber where sms.receiver_id=subscriber.id"
return db_query(db, sql_string)
def update_subscriber_auth(db, ext):
sql_string = "update subscriber set authorized=abs(authorized-1),lac=0,expire_lu=null,tmsi=null where extension=?"
db_execute(db, sql_string, (ext,))
def delete_sms(db, sms_id):
sql_string = "delete from sms where id=?"
db_execute(db, sql_string, (sms_id,))
def clear_sms(db):
sql_string = "delete from sms where 1=1"
db_execute(db, sql_string)
def update_imei_name(db, imei, name):
sql_string = "update equipment set name=? where imei=?"
db_execute(db, sql_string, (name,imei))
def update_imsi_name(db, imsi, name):
sql_string = "update subscriber set name=? where imsi=?"
db_execute(db, sql_string, (name,imsi))
## Server URLs ##
@view_config(context='pyramid.exceptions.NotFound', renderer='notfound.mako')
def notfound_view(self):
return {}
@view_config(route_name='www_root', renderer='home.mako')
def www_root(self):
return {}
@view_config(route_name='subscribers', renderer='subscribers.mako')
def subscriber_view(request):
settings = request.registry.settings
mcc_mnc = settings['mcc_mnc']
subscribers = []
result = get_subscribers(request.db)
if len(result)>0:
for row in result:
index = str(row[3])[:5]
if mcc_mnc.has_key(index):
operator=mcc_mnc[index]
else:
if mcc_mnc.has_key(index[:3]+"01"):
operator = list(mcc_mnc[index[:3]+"01"])
operator[1] = ""
else:
operator = None
subscribers.append(dict(ext=row[0], name=row[1], created=row[2], imsi=row[3], operator=operator, tmsi=row[4], lac=row[5], authorized=row[6]))
return {'subscribers': subscribers}
@view_config(route_name='subscriber_detail', renderer='subscriber_detail.mako')
def subscriber_detail_view(request):
settings = request.registry.settings
subscriber = []
mm = None
try:
ext = int(request.matchdict['extension'])
except:
return HTTPFound(request.route_path('subscribers'))
result = get_subscriber_detail(request.db, ext)
if len(result)>0:
reg_imei=RegisterIMEI()
for row in result:
imei = str(row[0]).zfill(15)
imei_checksum = reg_imei.calculate_luhn(imei)
if imei_checksum>0:
imei = imei[:-1]+str(imei_checksum)
subscriber.append(dict(imei=imei,name=row[1],updated=row[2]))
sgsn = connect_sgsn(settings)
if sgsn.connected==True:
mm = sgsn.get_mm_context(str(row[3]))
sgsn.close()
return {'extension': ext,'subscriber': subscriber, 'mm': mm}
@view_config(route_name='scripts', renderer='scripts.mako')
def scripts_view(request):
settings = request.registry.settings
p = subprocess.Popen(["/etc/init.d/lcr","status"],stdout=subprocess.PIPE)
lcr,err = p.communicate()
p.wait()
p = subprocess.Popen(["/etc/init.d/asterisk","status"],stdout=subprocess.PIPE)
asterisk,err = p.communicate()
p.wait()
p = subprocess.Popen(["/etc/init.d/openggsn","status"],stdout=subprocess.PIPE)
ggsn,err = p.communicate()
p.wait()
p = subprocess.Popen(["/etc/init.d/osmocom-nitb","status"],stdout=subprocess.PIPE)
nitb,err = p.communicate()
p.wait()
p = subprocess.Popen(["/etc/init.d/osmocom-sgsn","status"],stdout=subprocess.PIPE)
sgsn,err = p.communicate()
p.wait()
subMonitor = settings['subMonitor']
return {'service_status': dict(lcr=lcr, asterisk=asterisk, ggsn=ggsn, nitb=nitb, sgsn=sgsn, subMonitor=subMonitor.is_running())}
@view_config(route_name='sms', renderer='sms.mako')
def sms_view(request):
sms = []
sender = get_sms_senders(request.db)
receiver = get_sms_receivers(request.db)
if len(sender)>0 and len(sender)==len(receiver):
for i in range(0,len(sender)):
if sender[i][0]==receiver[i][0]:
sms.append(dict(id=receiver[i][0], from_id=sender[i][1], to_id=receiver[i][1], sent=sender[i][2], delivered=sender[i][3], message=sender[i][4]))
return {'sms': sms}
@view_config(route_name='bsc', renderer='bsc.mako')
def bsc_view(request):
settings = request.registry.settings
bsc_version=None
bsc_network=None
bsc_statistics=None
bsc = connect_bsc(settings)
if bsc.connected:
bsc_version = bsc.get_version()
bsc_network = bsc.get_network_info()
print bsc_network
bsc_statistics = bsc.get_network_statistics()
bsc.close()
return {'bsc_version': bsc_version, 'bsc_network': bsc_network, 'bsc_statistics': bsc_statistics}
@view_config(route_name='sgsn', renderer='sgsn.mako')
def sgsn_view(request):
settings = request.registry.settings
sgsn_version=None
ns_statistics=None
sgsn = connect_sgsn(settings)
if sgsn.connected:
sgsn_version = sgsn.get_version()
ns_statistics = sgsn.get_ns_stats()
sgsn.close()
return {'sgsn_version': sgsn_version, 'ns_statistics': ns_statistics}
@view_config(route_name='bts', renderer='bts.mako')
def bts_view(request):
settings = request.registry.settings
bts = collections.defaultdict()
phys_cfg = ["NONE","CCCH","CCCH+SDCCH4","TCH/F","TCH/H","SDCCH8","PDCH","TCH/F_PDCH"]
sgsn = connect_sgsn(settings)
bssgp = None
if sgsn.connected:
bssgp = sgsn.get_bssgp_stats()
bsc = connect_bsc(settings)
if bsc.connected:
bsc_network = bsc.get_network_info()
helper = str(bsc_network[0]).find("has")
num = int(str(bsc_network[0])[helper+4:].split()[0])
for i in range(0,num):
bts[i] = collections.defaultdict()
bts[i]['timeslots'] = collections.defaultdict()
bts[i]['stats'] = bsc.get_bts_info(str(i))
bts[i]['description'] = bts[i]['stats'][1].split(": ")[1].strip()
for j in range(0,8):
helper = bsc.get_timeslot_info(str(i), str(j))
bts[i]['timeslots'][j] = helper[0].replace("cfg","cfg:") + "," + helper[1]
bts[i]['timeslots'][j] = bts[i]['timeslots'][j].split(",")[3:]
if not bssgp==None:
cid = str(bts[i]['stats'][0][bts[i]['stats'][0].find("has CI ")+7])
if bssgp.has_key(cid):
bts[i]['bssgp'] = bssgp[cid]
nsei = str(bts[i]['bssgp'][0].split(",")[0].split()[1])
bts[i]['nsei'] = sgsn.get_nsei_info(nsei)
bts_tcp = bts[i]['nsei'][0].split()
bts[i]['ip'], bts[i]['port'] = bts_tcp[len(bts_tcp)-1].split(":")
bsc.close()
if sgsn.connected:
sgsn.close()
return {'bts': bts, 'phys_cfg': phys_cfg}
## Server Redirects ##
@view_config(route_name='delete_sms')
def delete_sms_view(request):
try:
sms_id = request.matchdict['id']
except:
return HTTPFound(request.route_path('sms'))
delete_sms(request.db, sms_id)
request.session.flash("SMS successfully deleted")
return HTTPFound(request.route_path('sms'))
@view_config(route_name='clear_sms')
def clear_sms_view(request):
clear_sms(request.db)
request.session.flash("SMS Registry Cleared!")
return HTTPFound(request.route_path('sms'))
@view_config(route_name='send_sms')
def send_sms_view(request):
try:
ext = str(request.matchdict['extension'])
text = str(request.GET.get('text'))
except:
HTTPFound(request.route_path('subscribers'))
settings = request.registry.settings
bsc = connect_bsc(settings)
if bsc.connected:
bsc.send_sms(ext, ext, text)
request.session.flash("SMS sent!")
bsc.close()
return HTTPFound(request.route_path('subscriber_detail',extension=ext))
@view_config(route_name='broadcast_sms')
def broadcast_sms_view(request):
settings = request.registry.settings
try:
text = str(request.GET.get('text'))
except:
return HTTPFound(request.route_path('sms'))
if len(text)>0:
result = get_attached_subscribers(request.db)
if len(result)>0:
bsc = connect_bsc(settings)
if bsc.connected:
for ext in result:
bsc.send_sms(ext[0], ext[0], text)
bsc.close()
request.session.flash("Broadcast SMS sent!")
else:
request.session.flash("Broadcast SMS NOT SENT! No active subscribers!")
return HTTPFound(request.route_path('sms'))
@view_config(route_name='manage_service')
def manage_service_view(request):
settings = request.registry.settings
try:
service = request.matchdict['service']
action = int(request.matchdict['action'])
except:
return HTTPFound(request.route_path('scripts'))
if service=="lcr" or service=="asterisk" or service=="ggsn" or service=="nitb" or service=="sgsn":
if service=="ggsn":
service = "openggsn"
if service=="nitb" or service=="sgsn":
service = "osmocom-" + service
if action==1:
subprocess.call(["/etc/init.d/"+service,"start"])
if action==2:
subprocess.call(["/etc/init.d/"+service,"restart"])
if action==3:
subprocess.call(["/etc/init.d/"+service,"stop"])
else:
if service=="subMonitor":
subMonitor = settings['subMonitor']
if action==1 and not subMonitor.is_running():
subMonitor.restart()
if action==2:
subMonitor.restart()
if action==3 and subMonitor.is_running():
subMonitor.stop()
return HTTPFound(request.route_path('scripts'))
## AJAX views ##
@view_config(route_name='authorize_toggle', renderer='json')
def authorize_toggle(request):
try:
ext = int(request.matchdict['extension'])
except:
return {'success':0}
update_subscriber_auth(request.db, ext)
return {'success':1}
@view_config(route_name='authorize_imei', renderer='json')
def authorize_imei(request):
settings = request.registry.settings
try:
imei = int(request.matchdict['imei'])
imei = str(imei).zfill(15)
except:
return {'success':0}
reg_imei = RegisterIMEI(settings['db'], imei)
if reg_imei.pre_checks()<0:
return {'success': reg_imei.pre_checks()}
reg_imei.setDaemon(True)
reg_imei.start()
return {'success':1}
@view_config(route_name='clear_component', renderer='json')
def clear_component_view(request):
try:
field = str(request.matchdict['field'])
reference = str(request.matchdict['reference'])
except:
return {'success':0}
return HTTPFound(request.route_path('rename_component',field=field,reference=reference,value="clear"))
@view_config(route_name='rename_component', renderer='json')
def rename_component_view(request):
try:
field = str(request.matchdict['field'])
reference = str(request.matchdict['reference'])
value = str(request.matchdict['value'])
except:
return {'success':0}
if(value=="clear"):
value=""
if(field=="imei" or field=="imsi"):
if(field=="imei"):
update_imei_name(request.db, reference, value)
if(field=="imsi"):
update_imsi_name(request.db, reference, value)
else:
return {'success':0}
return {'success':1}
@view_config(route_name='toggle_channel',renderer='json')
def bts_channel_view(request):
try:
bts_id = str(request.matchdict['bts_id'])
channel = str(request.matchdict['channel'])
config = str(request.GET.get('config'))
except:
return {'success': 0}
settings = request.registry.settings
bsc = connect_bsc(settings)
if bsc.connected and not config=="None":
bsc.configure_timeslot(bts_id, channel, config)
bsc.close()
else:
return {'success': 0}
return {'success': 1}

98
production.ini Normal file
View File

@ -0,0 +1,98 @@
# -*- coding: utf-8 -*-
###
# Copyright (C) 2013
# Fraunhofer Institute for Open Communication Systems (FOKUS)
# Competence Center NETwork research (NET), St. Augustin, GERMANY
# Alton MacDonald <alton.kenneth.macdonald@fokus.fraunhofer.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
###
[app:main]
use = egg:osmo-oohmi
pyramid.reload_templates = false
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
###
# wsgi server configuration
###
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 8080
###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
###
[loggers]
keys = root, osmo_oohmi, exc_logger
[handlers]
keys = console, exc_handler, filelog
[formatters]
keys = generic, exc_formatter
[logger_root]
level = INFO
handlers = console, filelog
[logger_osmo_oohmi]
level = WARN
handlers = filelog
qualname = osmo_oohmi
[logger_exc_logger]
#level = ERROR
level = NOTSET
handlers = exc_handler
qualname = exc_logger
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[handler_filelog]
class = FileHandler
args = ('/var/log/osmo-oohmi.log','a')
level = INFO
formatter = generic
[handler_exc_handler]
class = FileHandler
args = ('/var/log/osmo-oohmi.log','a')
#level = ERROR
level = NOTSET
formatter = exc_formatter
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
[formatter_exc_formatter]
format = %(asctime)s %(message)s

27
setup.cfg Normal file
View File

@ -0,0 +1,27 @@
[nosetests]
match = ^test
nocapture = 1
cover-package = osmo_oohmi
with-coverage = 1
cover-erase = 1
[compile_catalog]
directory = osmo_oohmi/locale
domain = osmo_oohmi
statistics = true
[extract_messages]
add_comments = TRANSLATORS:
output_file = osmo_oohmi/locale/osmo_oohmi.pot
width = 80
[init_catalog]
domain = osmo_oohmi
input_file = osmo_oohmi/locale/osmo_oohmi.pot
output_dir = osmo_oohmi/locale
[update_catalog]
domain = osmo_oohmi
input_file = osmo_oohmi/locale/osmo_oohmi.pot
output_dir = osmo_oohmi/locale
previous = true

62
setup.py Normal file
View File

@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
###
# Copyright (C) 2013
# Fraunhofer Institute for Open Communication Systems (FOKUS)
# Competence Center NETwork research (NET), St. Augustin, GERMANY
# Alton MacDonald <alton.kenneth.macdonald@fokus.fraunhofer.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
'pyramid_debugtoolbar',
'pyramid_exclog',
'waitress',
]
setup(name='osmo_oohmi',
version='0.0',
description='osmo_oohmi',
long_description=README + '\n\n' + CHANGES,
classifiers=[
"Programming Language :: Python",
"Framework :: Pyramid",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
],
author='Alton MacDonald',
author_email='alton.kenneth.macdonald@fokus.fraunhofer.de',
url='',
keywords='web pyramid pylons',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=requires,
tests_require=requires,
test_suite="osmo_oohmi",
entry_points="""\
[paste.app_factory]
main = hlr_mgmt:main
""",
)