Merge branch 'latest' of github.com:webnotes/wnframework into latest
This commit is contained in:
commit
59640bb7ad
33 changed files with 1867 additions and 576 deletions
352
css/bootstrap/bootstrap-topbar.css
vendored
Normal file
352
css/bootstrap/bootstrap-topbar.css
vendored
Normal file
|
|
@ -0,0 +1,352 @@
|
|||
.topbar {
|
||||
height: 40px;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10000;
|
||||
overflow: visible;
|
||||
}
|
||||
.topbar a {
|
||||
color: #bfbfbf;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
text-decoration: none;
|
||||
}
|
||||
.topbar h3 a:hover, .topbar .brand:hover, .topbar ul .active > a {
|
||||
background-color: #333;
|
||||
background-color: rgba(255, 255, 255, 0.05);
|
||||
color: #ffffff;
|
||||
text-decoration: none;
|
||||
}
|
||||
.topbar h3 {
|
||||
position: relative;
|
||||
}
|
||||
.topbar h3 a, .topbar .brand {
|
||||
float: left;
|
||||
display: block;
|
||||
padding: 8px 20px 12px;
|
||||
margin-left: -20px;
|
||||
color: #ffffff;
|
||||
font-size: 20px;
|
||||
font-weight: 200;
|
||||
line-height: 1;
|
||||
}
|
||||
.topbar p {
|
||||
margin: 0;
|
||||
line-height: 40px;
|
||||
}
|
||||
.topbar p a:hover {
|
||||
background-color: transparent;
|
||||
color: #ffffff;
|
||||
}
|
||||
.topbar form {
|
||||
float: left;
|
||||
margin: 5px 0 0 0;
|
||||
position: relative;
|
||||
filter: alpha(opacity=100);
|
||||
-khtml-opacity: 1;
|
||||
-moz-opacity: 1;
|
||||
opacity: 1;
|
||||
}
|
||||
.topbar form.pull-right {
|
||||
float: right;
|
||||
}
|
||||
.topbar input {
|
||||
background-color: #444;
|
||||
background-color: rgba(255, 255, 255, 0.3);
|
||||
font-family: inherit;
|
||||
font-size: normal;
|
||||
font-weight: 13px;
|
||||
line-height: 1;
|
||||
padding: 4px 9px;
|
||||
color: #ffffff;
|
||||
color: rgba(255, 255, 255, 0.75);
|
||||
border: 1px solid #111;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25);
|
||||
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25);
|
||||
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25);
|
||||
-webkit-transition: none;
|
||||
-moz-transition: none;
|
||||
-ms-transition: none;
|
||||
-o-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
.topbar input:-moz-placeholder {
|
||||
color: #e6e6e6;
|
||||
}
|
||||
.topbar input::-webkit-input-placeholder {
|
||||
color: #e6e6e6;
|
||||
}
|
||||
.topbar input:hover {
|
||||
background-color: #bfbfbf;
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
color: #ffffff;
|
||||
}
|
||||
.topbar input:focus, .topbar input.focused {
|
||||
outline: 0;
|
||||
background-color: #ffffff;
|
||||
color: #404040;
|
||||
text-shadow: 0 1px 0 #ffffff;
|
||||
border: 0;
|
||||
padding: 5px 10px;
|
||||
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
|
||||
-moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.topbar-inner, .topbar .fill {
|
||||
background-color: #222;
|
||||
background-color: #222222;
|
||||
background-repeat: repeat-x;
|
||||
background-image: -khtml-gradient(linear, left top, left bottom, from(#333333), to(#222222));
|
||||
background-image: -moz-linear-gradient(top, #333333, #222222);
|
||||
background-image: -ms-linear-gradient(top, #333333, #222222);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #333333), color-stop(100%, #222222));
|
||||
background-image: -webkit-linear-gradient(top, #333333, #222222);
|
||||
background-image: -o-linear-gradient(top, #333333, #222222);
|
||||
background-image: linear-gradient(top, #333333, #222222);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);
|
||||
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
|
||||
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.topbar div > ul, .nav {
|
||||
display: block;
|
||||
float: left;
|
||||
margin: 0 10px 0 0;
|
||||
position: relative;
|
||||
left: 0;
|
||||
}
|
||||
.topbar div > ul > li, .nav > li {
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
.topbar div > ul a, .nav a {
|
||||
display: block;
|
||||
float: none;
|
||||
padding: 10px 10px 11px;
|
||||
line-height: 19px;
|
||||
text-decoration: none;
|
||||
}
|
||||
.topbar div > ul a:hover, .nav a:hover {
|
||||
color: #ffffff;
|
||||
text-decoration: none;
|
||||
}
|
||||
.topbar div > ul .active > a, .nav .active > a {
|
||||
background-color: #222;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.topbar div > ul.secondary-nav, .nav.secondary-nav {
|
||||
float: right;
|
||||
margin-left: 10px;
|
||||
margin-right: 0;
|
||||
}
|
||||
.topbar div > ul.secondary-nav .menu-dropdown,
|
||||
.nav.secondary-nav .menu-dropdown,
|
||||
.topbar div > ul.secondary-nav .dropdown-menu,
|
||||
.nav.secondary-nav .dropdown-menu {
|
||||
right: 0;
|
||||
border: 0;
|
||||
}
|
||||
.topbar div > ul a.menu:hover,
|
||||
.nav a.menu:hover,
|
||||
.topbar div > ul li.open .menu,
|
||||
.nav li.open .menu,
|
||||
.topbar div > ul .dropdown-toggle:hover,
|
||||
.nav .dropdown-toggle:hover,
|
||||
.topbar div > ul .dropdown.open .dropdown-toggle,
|
||||
.nav .dropdown.open .dropdown-toggle {
|
||||
background: #444;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
.topbar div > ul .menu-dropdown,
|
||||
.nav .menu-dropdown,
|
||||
.topbar div > ul .dropdown-menu,
|
||||
.nav .dropdown-menu {
|
||||
background-color: #333;
|
||||
}
|
||||
.topbar div > ul .menu-dropdown a.menu,
|
||||
.nav .menu-dropdown a.menu,
|
||||
.topbar div > ul .dropdown-menu a.menu,
|
||||
.nav .dropdown-menu a.menu,
|
||||
.topbar div > ul .menu-dropdown .dropdown-toggle,
|
||||
.nav .menu-dropdown .dropdown-toggle,
|
||||
.topbar div > ul .dropdown-menu .dropdown-toggle,
|
||||
.nav .dropdown-menu .dropdown-toggle {
|
||||
color: #ffffff;
|
||||
}
|
||||
.topbar div > ul .menu-dropdown a.menu.open,
|
||||
.nav .menu-dropdown a.menu.open,
|
||||
.topbar div > ul .dropdown-menu a.menu.open,
|
||||
.nav .dropdown-menu a.menu.open,
|
||||
.topbar div > ul .menu-dropdown .dropdown-toggle.open,
|
||||
.nav .menu-dropdown .dropdown-toggle.open,
|
||||
.topbar div > ul .dropdown-menu .dropdown-toggle.open,
|
||||
.nav .dropdown-menu .dropdown-toggle.open {
|
||||
background: #444;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
.topbar div > ul .menu-dropdown li a,
|
||||
.nav .menu-dropdown li a,
|
||||
.topbar div > ul .dropdown-menu li a,
|
||||
.nav .dropdown-menu li a {
|
||||
color: #999;
|
||||
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.topbar div > ul .menu-dropdown li a:hover,
|
||||
.nav .menu-dropdown li a:hover,
|
||||
.topbar div > ul .dropdown-menu li a:hover,
|
||||
.nav .dropdown-menu li a:hover {
|
||||
background-color: #191919;
|
||||
background-repeat: repeat-x;
|
||||
background-image: -khtml-gradient(linear, left top, left bottom, from(#292929), to(#191919));
|
||||
background-image: -moz-linear-gradient(top, #292929, #191919);
|
||||
background-image: -ms-linear-gradient(top, #292929, #191919);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #292929), color-stop(100%, #191919));
|
||||
background-image: -webkit-linear-gradient(top, #292929, #191919);
|
||||
background-image: -o-linear-gradient(top, #292929, #191919);
|
||||
background-image: linear-gradient(top, #292929, #191919);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#292929', endColorstr='#191919', GradientType=0);
|
||||
color: #ffffff;
|
||||
}
|
||||
.topbar div > ul .menu-dropdown .active a,
|
||||
.nav .menu-dropdown .active a,
|
||||
.topbar div > ul .dropdown-menu .active a,
|
||||
.nav .dropdown-menu .active a {
|
||||
color: #ffffff;
|
||||
}
|
||||
.topbar div > ul .menu-dropdown .divider,
|
||||
.nav .menu-dropdown .divider,
|
||||
.topbar div > ul .dropdown-menu .divider,
|
||||
.nav .dropdown-menu .divider {
|
||||
background-color: #222;
|
||||
border-color: #444;
|
||||
}
|
||||
.topbar ul .menu-dropdown li a, .topbar ul .dropdown-menu li a {
|
||||
padding: 4px 15px;
|
||||
}
|
||||
li.menu, .dropdown {
|
||||
position: relative;
|
||||
}
|
||||
a.menu:after, .dropdown-toggle:after {
|
||||
width: 0;
|
||||
height: 0;
|
||||
display: inline-block;
|
||||
content: "↓";
|
||||
text-indent: -99999px;
|
||||
vertical-align: top;
|
||||
margin-top: 8px;
|
||||
margin-left: 4px;
|
||||
border-left: 4px solid transparent;
|
||||
border-right: 4px solid transparent;
|
||||
border-top: 4px solid #ffffff;
|
||||
filter: alpha(opacity=50);
|
||||
-khtml-opacity: 0.5;
|
||||
-moz-opacity: 0.5;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.menu-dropdown, .dropdown-menu {
|
||||
background-color: #ffffff;
|
||||
float: left;
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
z-index: 900;
|
||||
min-width: 160px;
|
||||
max-width: 220px;
|
||||
_width: 160px;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
padding: 6px 0;
|
||||
zoom: 1;
|
||||
border-color: #999;
|
||||
border-color: rgba(0, 0, 0, 0.2);
|
||||
border-style: solid;
|
||||
border-width: 0 1px 1px;
|
||||
-webkit-border-radius: 0 0 6px 6px;
|
||||
-moz-border-radius: 0 0 6px 6px;
|
||||
border-radius: 0 0 6px 6px;
|
||||
-webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||
-moz-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||
-webkit-background-clip: padding-box;
|
||||
-moz-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
}
|
||||
.menu-dropdown li, .dropdown-menu li {
|
||||
float: none;
|
||||
display: block;
|
||||
background-color: none;
|
||||
}
|
||||
.menu-dropdown .divider, .dropdown-menu .divider {
|
||||
height: 1px;
|
||||
margin: 5px 0;
|
||||
overflow: hidden;
|
||||
background-color: #eee;
|
||||
border-bottom: 1px solid #ffffff;
|
||||
}
|
||||
.topbar .dropdown-menu a, .dropdown-menu a {
|
||||
display: block;
|
||||
padding: 4px 15px;
|
||||
clear: both;
|
||||
font-weight: normal;
|
||||
line-height: 18px;
|
||||
color: #808080;
|
||||
text-shadow: 0 1px 0 #ffffff;
|
||||
}
|
||||
.topbar .dropdown-menu a:hover,
|
||||
.dropdown-menu a:hover,
|
||||
.topbar .dropdown-menu a.hover,
|
||||
.dropdown-menu a.hover {
|
||||
background-color: #dddddd;
|
||||
background-repeat: repeat-x;
|
||||
background-image: -khtml-gradient(linear, left top, left bottom, from(#eeeeee), to(#dddddd));
|
||||
background-image: -moz-linear-gradient(top, #eeeeee, #dddddd);
|
||||
background-image: -ms-linear-gradient(top, #eeeeee, #dddddd);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #eeeeee), color-stop(100%, #dddddd));
|
||||
background-image: -webkit-linear-gradient(top, #eeeeee, #dddddd);
|
||||
background-image: -o-linear-gradient(top, #eeeeee, #dddddd);
|
||||
background-image: linear-gradient(top, #eeeeee, #dddddd);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#dddddd', GradientType=0);
|
||||
color: #404040;
|
||||
text-decoration: none;
|
||||
-webkit-box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.025), inset 0 -1px rgba(0, 0, 0, 0.025);
|
||||
-moz-box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.025), inset 0 -1px rgba(0, 0, 0, 0.025);
|
||||
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.025), inset 0 -1px rgba(0, 0, 0, 0.025);
|
||||
}
|
||||
.open .menu,
|
||||
.dropdown.open .menu,
|
||||
.open .dropdown-toggle,
|
||||
.dropdown.open .dropdown-toggle {
|
||||
color: #ffffff;
|
||||
background: #ccc;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
.open .menu-dropdown,
|
||||
.dropdown.open .menu-dropdown,
|
||||
.open .dropdown-menu,
|
||||
.dropdown.open .dropdown-menu {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*extra size menus for recent*/
|
||||
.dropdown-menu#toolbar-recent, .dropdown-menu#toolbar-options, .dropdown-menu#toolbar-help{
|
||||
width: 260px !important;
|
||||
max-width: 260px !important;
|
||||
}
|
||||
|
||||
/* ajax spinner */
|
||||
.topbar #spinner {
|
||||
display: block;
|
||||
float: right;
|
||||
width: 20px;
|
||||
margin-bottom: -5px;
|
||||
margin-top: 10px;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.topbar-inner {
|
||||
padding: 0px 20px;
|
||||
}
|
||||
|
|
@ -13,8 +13,6 @@ body {
|
|||
|
||||
input, select, button { font-size: 12px; font-family: Arial, Helvetica, Sans; }
|
||||
|
||||
li { margin: 4px; }
|
||||
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: Tahoma, Sans;
|
||||
font-weight: normal;
|
||||
|
|
@ -60,6 +58,7 @@ div.comment { color: #444; }
|
|||
div#body_div {
|
||||
position: relative;
|
||||
display: none;
|
||||
margin-top: 48px;
|
||||
}
|
||||
|
||||
div.no_script {
|
||||
|
|
@ -149,3 +148,18 @@ div.std-footer-item {
|
|||
box-shadow: 1px 1px 6px #AAA;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
/* from bootstrap */
|
||||
.container {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
zoom: 1;
|
||||
}
|
||||
.container:before, .container:after {
|
||||
display: table;
|
||||
content: "";
|
||||
zoom: 1;
|
||||
}
|
||||
.container:after {
|
||||
clear: both;
|
||||
}
|
||||
|
|
|
|||
0
css/legacy/bootstrap-topbar.css
vendored
0
css/legacy/bootstrap-topbar.css
vendored
|
|
@ -13,8 +13,6 @@ body {
|
|||
|
||||
input, select, button { font-size: 12px; font-family: Arial, Helvetica, Sans; }
|
||||
|
||||
li { margin: 4px; }
|
||||
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: Tahoma, Sans;
|
||||
font-weight: normal;
|
||||
|
|
@ -60,6 +58,7 @@ div.comment { color: #444; }
|
|||
div#body_div {
|
||||
position: relative;
|
||||
display: none;
|
||||
margin-top: 48px;
|
||||
}
|
||||
|
||||
div.no_script {
|
||||
|
|
@ -150,6 +149,21 @@ div.std-footer-item {
|
|||
background-color: #FFF;
|
||||
}
|
||||
|
||||
/* from bootstrap */
|
||||
.container {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
zoom: 1;
|
||||
}
|
||||
.container:before, .container:after {
|
||||
display: table;
|
||||
content: "";
|
||||
zoom: 1;
|
||||
}
|
||||
.container:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
|
||||
/******** Menus - menu.js ************/
|
||||
|
||||
|
|
|
|||
113
js/bootstrap/bootstrap-alerts.js
vendored
Normal file
113
js/bootstrap/bootstrap-alerts.js
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
/* ==========================================================
|
||||
* bootstrap-alerts.js v1.4.0
|
||||
* http://twitter.github.com/bootstrap/javascript.html#alerts
|
||||
* ==========================================================
|
||||
* Copyright 2011 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"
|
||||
|
||||
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
|
||||
* ======================================================= */
|
||||
|
||||
var transitionEnd
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$.support.transition = (function () {
|
||||
var thisBody = document.body || document.documentElement
|
||||
, thisStyle = thisBody.style
|
||||
, support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
|
||||
return support
|
||||
})()
|
||||
|
||||
// set CSS transition event type
|
||||
if ( $.support.transition ) {
|
||||
transitionEnd = "TransitionEnd"
|
||||
if ( $.browser.webkit ) {
|
||||
transitionEnd = "webkitTransitionEnd"
|
||||
} else if ( $.browser.mozilla ) {
|
||||
transitionEnd = "transitionend"
|
||||
} else if ( $.browser.opera ) {
|
||||
transitionEnd = "oTransitionEnd"
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
/* ALERT CLASS DEFINITION
|
||||
* ====================== */
|
||||
|
||||
var Alert = function ( content, options ) {
|
||||
this.settings = $.extend({}, $.fn.alert.defaults, options)
|
||||
this.$element = $(content)
|
||||
.delegate(this.settings.selector, 'click', this.close)
|
||||
}
|
||||
|
||||
Alert.prototype = {
|
||||
|
||||
close: function (e) {
|
||||
var $element = $(this).parent('.alert-message')
|
||||
|
||||
e && e.preventDefault()
|
||||
$element.removeClass('in')
|
||||
|
||||
function removeElement () {
|
||||
$element.remove()
|
||||
}
|
||||
|
||||
$.support.transition && $element.hasClass('fade') ?
|
||||
$element.bind(transitionEnd, removeElement) :
|
||||
removeElement()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* ALERT PLUGIN DEFINITION
|
||||
* ======================= */
|
||||
|
||||
$.fn.alert = function ( options ) {
|
||||
|
||||
if ( options === true ) {
|
||||
return this.data('alert')
|
||||
}
|
||||
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
|
||||
if ( typeof options == 'string' ) {
|
||||
return $this.data('alert')[options]()
|
||||
}
|
||||
|
||||
$(this).data('alert', new Alert( this, options ))
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.alert.defaults = {
|
||||
selector: '.close'
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
new Alert($('body'), {
|
||||
selector: '.alert-message[data-alert] .close'
|
||||
})
|
||||
})
|
||||
|
||||
}( window.jQuery || window.ender );
|
||||
62
js/bootstrap/bootstrap-buttons.js
vendored
Normal file
62
js/bootstrap/bootstrap-buttons.js
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/* ============================================================
|
||||
* bootstrap-dropdown.js v1.4.0
|
||||
* http://twitter.github.com/bootstrap/javascript.html#dropdown
|
||||
* ============================================================
|
||||
* Copyright 2011 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"
|
||||
|
||||
function setState(el, state) {
|
||||
var d = 'disabled'
|
||||
, $el = $(el)
|
||||
, data = $el.data()
|
||||
|
||||
state = state + 'Text'
|
||||
data.resetText || $el.data('resetText', $el.html())
|
||||
|
||||
$el.html( data[state] || $.fn.button.defaults[state] )
|
||||
|
||||
state == 'loadingText' ?
|
||||
$el.addClass(d).attr(d, d) :
|
||||
$el.removeClass(d).removeAttr(d)
|
||||
}
|
||||
|
||||
function toggle(el) {
|
||||
$(el).toggleClass('active')
|
||||
}
|
||||
|
||||
$.fn.button = function(options) {
|
||||
return this.each(function () {
|
||||
if (options == 'toggle') {
|
||||
return toggle(this)
|
||||
}
|
||||
options && setState(this, options)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.button.defaults = {
|
||||
loadingText: 'loading...'
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$('body').delegate('.btn[data-toggle]', 'click', function () {
|
||||
$(this).button('toggle')
|
||||
})
|
||||
})
|
||||
|
||||
}( window.jQuery || window.ender );
|
||||
55
js/bootstrap/bootstrap-dropdown.js
vendored
Normal file
55
js/bootstrap/bootstrap-dropdown.js
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/* ============================================================
|
||||
* bootstrap-dropdown.js v1.4.0
|
||||
* http://twitter.github.com/bootstrap/javascript.html#dropdown
|
||||
* ============================================================
|
||||
* Copyright 2011 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"
|
||||
|
||||
/* DROPDOWN PLUGIN DEFINITION
|
||||
* ========================== */
|
||||
|
||||
$.fn.dropdown = function ( selector ) {
|
||||
return this.each(function () {
|
||||
$(this).delegate(selector || d, 'click', function (e) {
|
||||
var li = $(this).parent('li')
|
||||
, isActive = li.hasClass('open')
|
||||
|
||||
clearMenus()
|
||||
!isActive && li.toggleClass('open')
|
||||
return false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
||||
* =================================== */
|
||||
|
||||
var d = 'a.menu, .dropdown-toggle'
|
||||
|
||||
function clearMenus() {
|
||||
$(d).parent('li').removeClass('open')
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$('html').bind("click", clearMenus)
|
||||
$('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' )
|
||||
})
|
||||
|
||||
}( window.jQuery || window.ender );
|
||||
260
js/bootstrap/bootstrap-modal.js
vendored
Normal file
260
js/bootstrap/bootstrap-modal.js
vendored
Normal file
|
|
@ -0,0 +1,260 @@
|
|||
/* =========================================================
|
||||
* bootstrap-modal.js v1.4.0
|
||||
* http://twitter.github.com/bootstrap/javascript.html#modal
|
||||
* =========================================================
|
||||
* Copyright 2011 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"
|
||||
|
||||
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
|
||||
* ======================================================= */
|
||||
|
||||
var transitionEnd
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$.support.transition = (function () {
|
||||
var thisBody = document.body || document.documentElement
|
||||
, thisStyle = thisBody.style
|
||||
, support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
|
||||
return support
|
||||
})()
|
||||
|
||||
// set CSS transition event type
|
||||
if ( $.support.transition ) {
|
||||
transitionEnd = "TransitionEnd"
|
||||
if ( $.browser.webkit ) {
|
||||
transitionEnd = "webkitTransitionEnd"
|
||||
} else if ( $.browser.mozilla ) {
|
||||
transitionEnd = "transitionend"
|
||||
} else if ( $.browser.opera ) {
|
||||
transitionEnd = "oTransitionEnd"
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
/* MODAL PUBLIC CLASS DEFINITION
|
||||
* ============================= */
|
||||
|
||||
var Modal = function ( content, options ) {
|
||||
this.settings = $.extend({}, $.fn.modal.defaults, options)
|
||||
this.$element = $(content)
|
||||
.delegate('.close', 'click.modal', $.proxy(this.hide, this))
|
||||
|
||||
if ( this.settings.show ) {
|
||||
this.show()
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
Modal.prototype = {
|
||||
|
||||
toggle: function () {
|
||||
return this[!this.isShown ? 'show' : 'hide']()
|
||||
}
|
||||
|
||||
, show: function () {
|
||||
var that = this
|
||||
this.isShown = true
|
||||
this.$element.trigger('show')
|
||||
|
||||
escape.call(this)
|
||||
backdrop.call(this, function () {
|
||||
var transition = $.support.transition && that.$element.hasClass('fade')
|
||||
|
||||
that.$element
|
||||
.appendTo(document.body)
|
||||
.show()
|
||||
|
||||
if (transition) {
|
||||
that.$element[0].offsetWidth // force reflow
|
||||
}
|
||||
|
||||
that.$element.addClass('in')
|
||||
|
||||
transition ?
|
||||
that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
|
||||
that.$element.trigger('shown')
|
||||
|
||||
})
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
, hide: function (e) {
|
||||
e && e.preventDefault()
|
||||
|
||||
if ( !this.isShown ) {
|
||||
return this
|
||||
}
|
||||
|
||||
var that = this
|
||||
this.isShown = false
|
||||
|
||||
escape.call(this)
|
||||
|
||||
this.$element
|
||||
.trigger('hide')
|
||||
.removeClass('in')
|
||||
|
||||
$.support.transition && this.$element.hasClass('fade') ?
|
||||
hideWithTransition.call(this) :
|
||||
hideModal.call(this)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* MODAL PRIVATE METHODS
|
||||
* ===================== */
|
||||
|
||||
function hideWithTransition() {
|
||||
// firefox drops transitionEnd events :{o
|
||||
var that = this
|
||||
, timeout = setTimeout(function () {
|
||||
that.$element.unbind(transitionEnd)
|
||||
hideModal.call(that)
|
||||
}, 500)
|
||||
|
||||
this.$element.one(transitionEnd, function () {
|
||||
clearTimeout(timeout)
|
||||
hideModal.call(that)
|
||||
})
|
||||
}
|
||||
|
||||
function hideModal (that) {
|
||||
this.$element
|
||||
.hide()
|
||||
.trigger('hidden')
|
||||
|
||||
backdrop.call(this)
|
||||
}
|
||||
|
||||
function backdrop ( callback ) {
|
||||
var that = this
|
||||
, animate = this.$element.hasClass('fade') ? 'fade' : ''
|
||||
if ( this.isShown && this.settings.backdrop ) {
|
||||
var doAnimate = $.support.transition && animate
|
||||
|
||||
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
||||
.appendTo(document.body)
|
||||
|
||||
if ( this.settings.backdrop != 'static' ) {
|
||||
this.$backdrop.click($.proxy(this.hide, this))
|
||||
}
|
||||
|
||||
if ( doAnimate ) {
|
||||
this.$backdrop[0].offsetWidth // force reflow
|
||||
}
|
||||
|
||||
this.$backdrop.addClass('in')
|
||||
|
||||
doAnimate ?
|
||||
this.$backdrop.one(transitionEnd, callback) :
|
||||
callback()
|
||||
|
||||
} else if ( !this.isShown && this.$backdrop ) {
|
||||
this.$backdrop.removeClass('in')
|
||||
|
||||
$.support.transition && this.$element.hasClass('fade')?
|
||||
this.$backdrop.one(transitionEnd, $.proxy(removeBackdrop, this)) :
|
||||
removeBackdrop.call(this)
|
||||
|
||||
} else if ( callback ) {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
||||
function removeBackdrop() {
|
||||
this.$backdrop.remove()
|
||||
this.$backdrop = null
|
||||
}
|
||||
|
||||
function escape() {
|
||||
var that = this
|
||||
if ( this.isShown && this.settings.keyboard ) {
|
||||
$(document).bind('keyup.modal', function ( e ) {
|
||||
if ( e.which == 27 ) {
|
||||
that.hide()
|
||||
}
|
||||
})
|
||||
} else if ( !this.isShown ) {
|
||||
$(document).unbind('keyup.modal')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* MODAL PLUGIN DEFINITION
|
||||
* ======================= */
|
||||
|
||||
$.fn.modal = function ( options ) {
|
||||
var modal = this.data('modal')
|
||||
|
||||
if (!modal) {
|
||||
|
||||
if (typeof options == 'string') {
|
||||
options = {
|
||||
show: /show|toggle/.test(options)
|
||||
}
|
||||
}
|
||||
|
||||
return this.each(function () {
|
||||
$(this).data('modal', new Modal(this, options))
|
||||
})
|
||||
}
|
||||
|
||||
if ( options === true ) {
|
||||
return modal
|
||||
}
|
||||
|
||||
if ( typeof options == 'string' ) {
|
||||
modal[options]()
|
||||
} else if ( modal ) {
|
||||
modal.toggle()
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
$.fn.modal.Modal = Modal
|
||||
|
||||
$.fn.modal.defaults = {
|
||||
backdrop: false
|
||||
, keyboard: false
|
||||
, show: false
|
||||
}
|
||||
|
||||
|
||||
/* MODAL DATA- IMPLEMENTATION
|
||||
* ========================== */
|
||||
|
||||
$(document).ready(function () {
|
||||
$('body').delegate('[data-controls-modal]', 'click', function (e) {
|
||||
e.preventDefault()
|
||||
var $this = $(this).data('show', true)
|
||||
$('#' + $this.attr('data-controls-modal')).modal( $this.data() )
|
||||
})
|
||||
})
|
||||
|
||||
}( window.jQuery || window.ender );
|
||||
86
js/bootstrap/bootstrap-popover.js
vendored
Normal file
86
js/bootstrap/bootstrap-popover.js
vendored
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/* ===========================================================
|
||||
* bootstrap-popover.js v1.4.0
|
||||
* http://twitter.github.com/bootstrap/javascript.html#popover
|
||||
* ===========================================================
|
||||
* Copyright 2011 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"
|
||||
|
||||
var Popover = function ( element, options ) {
|
||||
this.$element = $(element)
|
||||
this.options = options
|
||||
this.enabled = true
|
||||
this.fixTitle()
|
||||
}
|
||||
|
||||
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js
|
||||
========================================= */
|
||||
|
||||
Popover.prototype = $.extend({}, $.fn.twipsy.Twipsy.prototype, {
|
||||
|
||||
setContent: function () {
|
||||
var $tip = this.tip()
|
||||
$tip.find('.title')[this.options.html ? 'html' : 'text'](this.getTitle())
|
||||
$tip.find('.content p')[this.options.html ? 'html' : 'text'](this.getContent())
|
||||
$tip[0].className = 'popover'
|
||||
}
|
||||
|
||||
, hasContent: function () {
|
||||
return this.getTitle() || this.getContent()
|
||||
}
|
||||
|
||||
, getContent: function () {
|
||||
var content
|
||||
, $e = this.$element
|
||||
, o = this.options
|
||||
|
||||
if (typeof this.options.content == 'string') {
|
||||
content = this.options.content
|
||||
} else if (typeof this.options.content == 'function') {
|
||||
content = this.options.content.call(this.$element[0])
|
||||
}
|
||||
return content
|
||||
}
|
||||
|
||||
, tip: function() {
|
||||
if (!this.$tip) {
|
||||
this.$tip = $('<div class="popover" />')
|
||||
.html(this.options.template)
|
||||
}
|
||||
return this.$tip
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
/* POPOVER PLUGIN DEFINITION
|
||||
* ======================= */
|
||||
|
||||
$.fn.popover = function (options) {
|
||||
if (typeof options == 'object') options = $.extend({}, $.fn.popover.defaults, options)
|
||||
$.fn.twipsy.initWith.call(this, options, Popover, 'popover')
|
||||
return this
|
||||
}
|
||||
|
||||
$.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
|
||||
placement: 'right'
|
||||
, template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
|
||||
})
|
||||
|
||||
}( window.jQuery || window.ender );
|
||||
107
js/bootstrap/bootstrap-scrollspy.js
vendored
Normal file
107
js/bootstrap/bootstrap-scrollspy.js
vendored
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/* =============================================================
|
||||
* bootstrap-scrollspy.js v1.4.0
|
||||
* http://twitter.github.com/bootstrap/javascript.html#scrollspy
|
||||
* =============================================================
|
||||
* Copyright 2011 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"
|
||||
|
||||
var $window = $(window)
|
||||
|
||||
function ScrollSpy( topbar, selector ) {
|
||||
var processScroll = $.proxy(this.processScroll, this)
|
||||
this.$topbar = $(topbar)
|
||||
this.selector = selector || 'li > a'
|
||||
this.refresh()
|
||||
this.$topbar.delegate(this.selector, 'click', processScroll)
|
||||
$window.scroll(processScroll)
|
||||
this.processScroll()
|
||||
}
|
||||
|
||||
ScrollSpy.prototype = {
|
||||
|
||||
refresh: function () {
|
||||
this.targets = this.$topbar.find(this.selector).map(function () {
|
||||
var href = $(this).attr('href')
|
||||
return /^#\w/.test(href) && $(href).length ? href : null
|
||||
})
|
||||
|
||||
this.offsets = $.map(this.targets, function (id) {
|
||||
return $(id).offset().top
|
||||
})
|
||||
}
|
||||
|
||||
, processScroll: function () {
|
||||
var scrollTop = $window.scrollTop() + 10
|
||||
, offsets = this.offsets
|
||||
, targets = this.targets
|
||||
, activeTarget = this.activeTarget
|
||||
, i
|
||||
|
||||
for (i = offsets.length; i--;) {
|
||||
activeTarget != targets[i]
|
||||
&& scrollTop >= offsets[i]
|
||||
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
|
||||
&& this.activateButton( targets[i] )
|
||||
}
|
||||
}
|
||||
|
||||
, activateButton: function (target) {
|
||||
this.activeTarget = target
|
||||
|
||||
this.$topbar
|
||||
.find(this.selector).parent('.active')
|
||||
.removeClass('active')
|
||||
|
||||
this.$topbar
|
||||
.find(this.selector + '[href="' + target + '"]')
|
||||
.parent('li')
|
||||
.addClass('active')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* SCROLLSPY PLUGIN DEFINITION
|
||||
* =========================== */
|
||||
|
||||
$.fn.scrollSpy = function( options ) {
|
||||
var scrollspy = this.data('scrollspy')
|
||||
|
||||
if (!scrollspy) {
|
||||
return this.each(function () {
|
||||
$(this).data('scrollspy', new ScrollSpy( this, options ))
|
||||
})
|
||||
}
|
||||
|
||||
if ( options === true ) {
|
||||
return scrollspy
|
||||
}
|
||||
|
||||
if ( typeof options == 'string' ) {
|
||||
scrollspy[options]()
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('body').scrollSpy('[data-scrollspy] li > a')
|
||||
})
|
||||
|
||||
}( window.jQuery || window.ender );
|
||||
80
js/bootstrap/bootstrap-tabs.js
vendored
Normal file
80
js/bootstrap/bootstrap-tabs.js
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/* ========================================================
|
||||
* bootstrap-tabs.js v1.4.0
|
||||
* http://twitter.github.com/bootstrap/javascript.html#tabs
|
||||
* ========================================================
|
||||
* Copyright 2011 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"
|
||||
|
||||
function activate ( element, container ) {
|
||||
container
|
||||
.find('> .active')
|
||||
.removeClass('active')
|
||||
.find('> .dropdown-menu > .active')
|
||||
.removeClass('active')
|
||||
|
||||
element.addClass('active')
|
||||
|
||||
if ( element.parent('.dropdown-menu') ) {
|
||||
element.closest('li.dropdown').addClass('active')
|
||||
}
|
||||
}
|
||||
|
||||
function tab( e ) {
|
||||
var $this = $(this)
|
||||
, $ul = $this.closest('ul:not(.dropdown-menu)')
|
||||
, href = $this.attr('href')
|
||||
, previous
|
||||
, $href
|
||||
|
||||
if ( /^#\w+/.test(href) ) {
|
||||
e.preventDefault()
|
||||
|
||||
if ( $this.parent('li').hasClass('active') ) {
|
||||
return
|
||||
}
|
||||
|
||||
previous = $ul.find('.active a').last()[0]
|
||||
$href = $(href)
|
||||
|
||||
activate($this.parent('li'), $ul)
|
||||
activate($href, $href.parent())
|
||||
|
||||
$this.trigger({
|
||||
type: 'change'
|
||||
, relatedTarget: previous
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* TABS/PILLS PLUGIN DEFINITION
|
||||
* ============================ */
|
||||
|
||||
$.fn.tabs = $.fn.pills = function ( selector ) {
|
||||
return this.each(function () {
|
||||
$(this).delegate(selector || '.tabs li > a, .pills > li > a', 'click', tab)
|
||||
})
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a')
|
||||
})
|
||||
|
||||
}( window.jQuery || window.ender );
|
||||
310
js/bootstrap/bootstrap-twipsy.js
vendored
Normal file
310
js/bootstrap/bootstrap-twipsy.js
vendored
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
/* ==========================================================
|
||||
* bootstrap-twipsy.js v1.4.0
|
||||
* http://twitter.github.com/bootstrap/javascript.html#twipsy
|
||||
* Adapted from the original jQuery.tipsy by Jason Frame
|
||||
* ==========================================================
|
||||
* Copyright 2011 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"
|
||||
|
||||
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
|
||||
* ======================================================= */
|
||||
|
||||
var transitionEnd
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$.support.transition = (function () {
|
||||
var thisBody = document.body || document.documentElement
|
||||
, thisStyle = thisBody.style
|
||||
, support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
|
||||
return support
|
||||
})()
|
||||
|
||||
// set CSS transition event type
|
||||
if ( $.support.transition ) {
|
||||
transitionEnd = "TransitionEnd"
|
||||
if ( $.browser.webkit ) {
|
||||
transitionEnd = "webkitTransitionEnd"
|
||||
} else if ( $.browser.mozilla ) {
|
||||
transitionEnd = "transitionend"
|
||||
} else if ( $.browser.opera ) {
|
||||
transitionEnd = "oTransitionEnd"
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
/* TWIPSY PUBLIC CLASS DEFINITION
|
||||
* ============================== */
|
||||
|
||||
var Twipsy = function ( element, options ) {
|
||||
this.$element = $(element)
|
||||
this.options = options
|
||||
this.enabled = true
|
||||
this.fixTitle()
|
||||
}
|
||||
|
||||
Twipsy.prototype = {
|
||||
|
||||
show: function() {
|
||||
var pos
|
||||
, actualWidth
|
||||
, actualHeight
|
||||
, placement
|
||||
, $tip
|
||||
, tp
|
||||
|
||||
if (this.hasContent() && this.enabled) {
|
||||
$tip = this.tip()
|
||||
this.setContent()
|
||||
|
||||
if (this.options.animate) {
|
||||
$tip.addClass('fade')
|
||||
}
|
||||
|
||||
$tip
|
||||
.remove()
|
||||
.css({ top: 0, left: 0, display: 'block' })
|
||||
.prependTo(document.body)
|
||||
|
||||
pos = $.extend({}, this.$element.offset(), {
|
||||
width: this.$element[0].offsetWidth
|
||||
, height: this.$element[0].offsetHeight
|
||||
})
|
||||
|
||||
actualWidth = $tip[0].offsetWidth
|
||||
actualHeight = $tip[0].offsetHeight
|
||||
|
||||
placement = maybeCall(this.options.placement, this, [ $tip[0], this.$element[0] ])
|
||||
|
||||
switch (placement) {
|
||||
case 'below':
|
||||
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
|
||||
break
|
||||
case 'above':
|
||||
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
|
||||
break
|
||||
case 'left':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}
|
||||
break
|
||||
case 'right':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}
|
||||
break
|
||||
}
|
||||
|
||||
$tip
|
||||
.css(tp)
|
||||
.addClass(placement)
|
||||
.addClass('in')
|
||||
}
|
||||
}
|
||||
|
||||
, setContent: function () {
|
||||
var $tip = this.tip()
|
||||
$tip.find('.twipsy-inner')[this.options.html ? 'html' : 'text'](this.getTitle())
|
||||
$tip[0].className = 'twipsy'
|
||||
}
|
||||
|
||||
, hide: function() {
|
||||
var that = this
|
||||
, $tip = this.tip()
|
||||
|
||||
$tip.removeClass('in')
|
||||
|
||||
function removeElement () {
|
||||
$tip.remove()
|
||||
}
|
||||
|
||||
$.support.transition && this.$tip.hasClass('fade') ?
|
||||
$tip.bind(transitionEnd, removeElement) :
|
||||
removeElement()
|
||||
}
|
||||
|
||||
, 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()
|
||||
}
|
||||
|
||||
, getTitle: function() {
|
||||
var title
|
||||
, $e = this.$element
|
||||
, o = this.options
|
||||
|
||||
this.fixTitle()
|
||||
|
||||
if (typeof o.title == 'string') {
|
||||
title = $e.attr(o.title == 'title' ? 'data-original-title' : o.title)
|
||||
} else if (typeof o.title == 'function') {
|
||||
title = o.title.call($e[0])
|
||||
}
|
||||
|
||||
title = ('' + title).replace(/(^\s*|\s*$)/, "")
|
||||
|
||||
return title || o.fallback
|
||||
}
|
||||
|
||||
, tip: function() {
|
||||
if (!this.$tip) {
|
||||
this.$tip = $('<div class="twipsy" />').html(this.options.template)
|
||||
}
|
||||
return this.$tip
|
||||
}
|
||||
|
||||
, 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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* TWIPSY PRIVATE METHODS
|
||||
* ====================== */
|
||||
|
||||
function maybeCall ( thing, ctx, args ) {
|
||||
return typeof thing == 'function' ? thing.apply(ctx, args) : thing
|
||||
}
|
||||
|
||||
/* TWIPSY PLUGIN DEFINITION
|
||||
* ======================== */
|
||||
|
||||
$.fn.twipsy = function (options) {
|
||||
$.fn.twipsy.initWith.call(this, options, Twipsy, 'twipsy')
|
||||
return this
|
||||
}
|
||||
|
||||
$.fn.twipsy.initWith = function (options, Constructor, name) {
|
||||
var twipsy
|
||||
, binder
|
||||
, eventIn
|
||||
, eventOut
|
||||
|
||||
if (options === true) {
|
||||
return this.data(name)
|
||||
} else if (typeof options == 'string') {
|
||||
twipsy = this.data(name)
|
||||
if (twipsy) {
|
||||
twipsy[options]()
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
options = $.extend({}, $.fn[name].defaults, options)
|
||||
|
||||
function get(ele) {
|
||||
var twipsy = $.data(ele, name)
|
||||
|
||||
if (!twipsy) {
|
||||
twipsy = new Constructor(ele, $.fn.twipsy.elementOptions(ele, options))
|
||||
$.data(ele, name, twipsy)
|
||||
}
|
||||
|
||||
return twipsy
|
||||
}
|
||||
|
||||
function enter() {
|
||||
var twipsy = get(this)
|
||||
twipsy.hoverState = 'in'
|
||||
|
||||
if (options.delayIn == 0) {
|
||||
twipsy.show()
|
||||
} else {
|
||||
twipsy.fixTitle()
|
||||
setTimeout(function() {
|
||||
if (twipsy.hoverState == 'in') {
|
||||
twipsy.show()
|
||||
}
|
||||
}, options.delayIn)
|
||||
}
|
||||
}
|
||||
|
||||
function leave() {
|
||||
var twipsy = get(this)
|
||||
twipsy.hoverState = 'out'
|
||||
if (options.delayOut == 0) {
|
||||
twipsy.hide()
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
if (twipsy.hoverState == 'out') {
|
||||
twipsy.hide()
|
||||
}
|
||||
}, options.delayOut)
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.live) {
|
||||
this.each(function() {
|
||||
get(this)
|
||||
})
|
||||
}
|
||||
|
||||
if (options.trigger != 'manual') {
|
||||
binder = options.live ? 'live' : 'bind'
|
||||
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus'
|
||||
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'
|
||||
this[binder](eventIn, enter)[binder](eventOut, leave)
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
$.fn.twipsy.Twipsy = Twipsy
|
||||
|
||||
$.fn.twipsy.defaults = {
|
||||
animate: true
|
||||
, delayIn: 0
|
||||
, delayOut: 0
|
||||
, fallback: ''
|
||||
, placement: 'above'
|
||||
, html: false
|
||||
, live: false
|
||||
, offset: 0
|
||||
, title: 'title'
|
||||
, trigger: 'hover'
|
||||
, template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
|
||||
}
|
||||
|
||||
$.fn.twipsy.elementOptions = function(ele, options) {
|
||||
return $.extend({}, options, $(ele).data())
|
||||
}
|
||||
|
||||
}( window.jQuery || window.ender );
|
||||
5
js/core.min.js
vendored
5
js/core.min.js
vendored
|
|
@ -10,10 +10,9 @@ wn.versions={check:function(){if(localStorage){if(window._version_number==-1||pa
|
|||
localStorage.setItem('_version_number',window._version_number);}}}
|
||||
wn.assets={executed_:{},exists:function(src){if('localStorage'in window&&localStorage.getItem(src))
|
||||
return true},add:function(src,txt){if('localStorage'in window){localStorage.setItem(src,txt);}},get:function(src){return localStorage.getItem(src);},extn:function(src){if(src.indexOf('?')!=-1){src=src.split('?').slice(-1)[0];}
|
||||
return src.split('.').slice(-1)[0];},html_src:function(src){if(src.indexOf('/')!=-1){var t=src.split('/').slice(0,-1);t.push('src');t=t.join('/')+'/'+a.split('/').slice(-1)[0];}else{var t='src/'+src;}
|
||||
return t;},load:function(src){var t=wn.assets.extn(src)=='html'?wn.assets.html_src(src):src;wn.xmlhttp.get(t,function(txt){wn.assets.add(src,txt);},'q='&Math.floor(Math.random()*1000),false)},execute:function(src){if(!wn.assets.exists(src)){wn.assets.load(src);}
|
||||
return src.split('.').slice(-1)[0];},load:function(src){var t=src;wn.xmlhttp.get(t,function(txt){wn.assets.add(src,txt);},'q='+Math.floor(Math.random()*1000),false)},execute:function(src){if(!wn.assets.exists(src)){wn.assets.load(src);}
|
||||
var type=wn.assets.extn(src);if(wn.assets.handler[type]){wn.assets.handler[type](wn.assets.get(src),src);wn.assets.executed_[src]=1;}},handler:{js:function(txt,src){wn.dom.eval(txt);},css:function(txt,src){var se=document.createElement('style');se.type="text/css";if(se.styleSheet){se.styleSheet.cssText=txt;}else{se.appendChild(document.createTextNode(txt));}
|
||||
document.getElementsByTagName('head')[0].appendChild(se);},html:function(txt,src){var page=wn.dom.add($('.outer .inner').get(0),'div','content',null,txt);page.setAttribute("_src",src);},cgi:function(txt,src){wn.dom.eval(txt)}}}
|
||||
document.getElementsByTagName('head')[0].appendChild(se);},cgi:function(txt,src){wn.dom.eval(txt)}}}
|
||||
wn.require=function(items){if(typeof items==="string"){items=[items];}
|
||||
var l=items.length;for(var i=0;i<l;i++){var src=items[i];if(!(src in wn.assets.executed_)){wn.assets.execute(src);}}}
|
||||
wn.provide('wn.dom');wn.dom.by_id=function(id){return document.getElementById(id);}
|
||||
|
|
|
|||
|
|
@ -193,10 +193,9 @@ window.onresize = function() {
|
|||
|
||||
get_window_height = function() {
|
||||
var ht = window.innerHeight ? window.innerHeight : document.documentElement.offsetHeight ? document.documentElement.offsetHeight : document.body.offsetHeight;
|
||||
var toolbarh = page_body.wntoolbar ? page_body.wntoolbar.wrapper.offsetHeight : 0
|
||||
var bannerh = page_body.banner_area ? page_body.banner_area.offsetHeight : 0
|
||||
var footerh = page_body.footer ? page_body.footer.offsetHeight : 0
|
||||
ht = ht - bannerh - toolbarh - footerh;
|
||||
ht = ht - bannerh - footerh;
|
||||
return ht;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
,"widgets/listing.js"
|
||||
,"wn/widgets/listing.js"
|
||||
,"widgets/tree.js"
|
||||
,"widgets/menu.js"
|
||||
,"widgets/layout.js"
|
||||
,"widgets/tabbedpage.js"
|
||||
,"webpage/page_header.js"
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ _f.Frm.prototype.defocus_rest=function(){mclose();if(_f.cur_grid_cell)_f.cur_gri
|
|||
_f.Frm.prototype.get_doc_perms=function(){var p=[0,0,0,0,0,0];for(var i=0;i<this.perm.length;i++){if(this.perm[i]){if(this.perm[i][READ])p[READ]=1;if(this.perm[i][WRITE])p[WRITE]=1;if(this.perm[i][SUBMIT])p[SUBMIT]=1;if(this.perm[i][CANCEL])p[CANCEL]=1;if(this.perm[i][AMEND])p[AMEND]=1;}}
|
||||
return p;}
|
||||
_f.Frm.prototype.refresh_header=function(){if(!this.meta.in_dialog){set_title(this.meta.issingle?this.doctype:this.docname);}
|
||||
if(this.frm_head)this.frm_head.refresh_toolbar();if(page_body.wntoolbar)page_body.wntoolbar.rdocs.add(this.doctype,this.docname,1);this.set_heading();}
|
||||
if(this.frm_head)this.frm_head.refresh_toolbar();if(wn.ui.toolbar.recent)wn.ui.toolbar.recent.add(this.doctype,this.docname,1);this.set_heading();}
|
||||
_f.Frm.prototype.check_doc_perm=function(){var dt=this.parent_doctype?this.parent_doctype:this.doctype;var dn=this.parent_docname?this.parent_docname:this.docname;this.perm=get_perm(dt,dn);this.orig_perm=get_perm(dt,dn,1);if(!this.perm[0][READ]){if(user=='Guest'){if(_f.temp_access[dt]&&_f.temp_access[dt][dn]){this.perm=[[1,0,0]]
|
||||
return 1;}}
|
||||
nav_obj.show_last_open();return 0;}
|
||||
|
|
@ -184,7 +184,7 @@ _f.Frm.prototype.savedoc=function(save_action,onsave,onerr){this.error_in_sectio
|
|||
_f.Frm.prototype.saveupdate=function(){this.save('Update');}
|
||||
_f.Frm.prototype.savesubmit=function(){var answer=confirm("Permanently Submit "+this.docname+"?");var me=this;if(answer){this.save('Submit',function(r){if(!r.exc&&me.cscript.on_submit){me.runclientscript('on_submit',me.doctype,me.docname);}});}}
|
||||
_f.Frm.prototype.savecancel=function(){var answer=confirm("Permanently Cancel "+this.docname+"?");if(answer)this.save('Cancel');}
|
||||
_f.Frm.prototype.savetrash=function(){var me=this;var answer=confirm("Permanently Delete "+this.docname+"? This action cannot be reversed");if(answer){$c('webnotes.model.delete_doc',{dt:this.doctype,dn:this.docname},function(r,rt){if(r.message=='okay'){LocalDB.delete_doc(me.doctype,me.docname);if(page_body.wntoolbar)page_body.wntoolbar.rdocs.remove(me.doctype,me.docname);nav_obj.show_last_open();}})}}
|
||||
_f.Frm.prototype.savetrash=function(){var me=this;var answer=confirm("Permanently Delete "+this.docname+"? This action cannot be reversed");if(answer){$c('webnotes.model.delete_doc',{dt:this.doctype,dn:this.docname},function(r,rt){if(r.message=='okay'){LocalDB.delete_doc(me.doctype,me.docname);if(wn.ui.toolbar.recent)wn.ui.toolbar.recent.remove(me.doctype,me.docname);nav_obj.show_last_open();}})}}
|
||||
_f.Frm.prototype.amend_doc=function(){if(!this.fields_dict['amended_from']){alert('"amended_from" field must be present to do an amendment.');return;}
|
||||
var me=this;var fn=function(newdoc){newdoc.amended_from=me.docname;if(me.fields_dict&&me.fields_dict['amendment_date'])
|
||||
newdoc.amendment_date=dateutil.obj_to_str(new Date());}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ function Body() {
|
|||
this.setup = function() {
|
||||
this.cp = locals['Control Panel']['Control Panel'];
|
||||
|
||||
this.wntoolbar_area = $a($i('body_div'),'div'); // $a(document.getElementsByTagName('body')[0], 'div');
|
||||
this.wrapper = $a($i('body_div'),'div');
|
||||
this.banner_area = $a(this.wrapper, 'div');;
|
||||
|
||||
|
|
@ -122,9 +121,8 @@ function Body() {
|
|||
// core areas;
|
||||
if(user=='Guest') user_defaults.hide_webnotes_toolbar = 1;
|
||||
if(!cint(user_defaults.hide_webnotes_toolbar) || user=='Administrator') {
|
||||
wn.require('lib/js/legacy/webpage/wntoolbar.js');
|
||||
this.wntoolbar = new WNToolbar(this.wntoolbar_area);
|
||||
$y(this.wrapper, {marginTop: this.wntoolbar.wrapper.offsetHeight + 'px'});
|
||||
wn.require('lib/js/wn/ui/toolbar/toolbar.js');
|
||||
this.wntoolbar = new wn.ui.toolbar.Toolbar();
|
||||
}
|
||||
|
||||
// page width
|
||||
|
|
|
|||
|
|
@ -109,8 +109,6 @@ function makeselector() {
|
|||
}
|
||||
}
|
||||
d.onhide = function() {
|
||||
if(page_body.wntoolbar)
|
||||
page_body.wntoolbar.search_sel.disabled = 0;
|
||||
if(d.input && d.input.txt) // link, call onchange
|
||||
d.input.txt.onchange()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,13 @@
|
|||
var _loading_div;
|
||||
function set_loading() {
|
||||
if(page_body.wntoolbar)$ds(page_body.wntoolbar.spinner);
|
||||
$y(document.getElementsByTagName('body')[0], {cursor:'progress'});
|
||||
if(page_body.on_start_spinner) page_body.on_start_spinner();
|
||||
pending_req++;
|
||||
$('#spinner').css('visibility', 'visible');
|
||||
$('body').css('cursor', 'progress');
|
||||
}
|
||||
|
||||
function hide_loading() {
|
||||
pending_req--;
|
||||
if(!pending_req){
|
||||
$y(document.getElementsByTagName('body')[0], {cursor:'default'});
|
||||
if(page_body.wntoolbar)
|
||||
var d = page_body.wntoolbar.spinner;
|
||||
if(d) $dh(d);
|
||||
if(page_body.on_stop_spinner) page_body.on_stop_spinner();
|
||||
$('body').css('cursor', 'default');
|
||||
$('#spinner').css('visibility', 'hidden');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,290 +0,0 @@
|
|||
// requires
|
||||
// menu.js
|
||||
// search.js
|
||||
// datatype.js
|
||||
// dom.js
|
||||
|
||||
var about_dialog;
|
||||
|
||||
function WNToolbar(parent) {
|
||||
var me = this;
|
||||
|
||||
this.setup = function() {
|
||||
this.wrapper = $a(parent, 'div', '', {color:'#FFF', padding:'2px 0px' });
|
||||
set_gradient(this.wrapper, '#444', '#000');
|
||||
|
||||
this.table_wrapper = $a(this.wrapper, 'div', '', {marginLeft:'4px', padding:'2px'});
|
||||
this.body_tab = make_table(this.table_wrapper, 1, 3, '100%', ['0%','64%','36%'],{verticalAlign:'middle'});
|
||||
|
||||
this.menu = new MenuToolbar($td(this.body_tab,0,1));
|
||||
this.setup_home();
|
||||
this.setup_new();
|
||||
this.setup_search();
|
||||
this.setup_recent();
|
||||
if(in_list(user_roles, 'Administrator'))
|
||||
this.setup_options();
|
||||
this.setup_help();
|
||||
|
||||
this.setup_report_builder();
|
||||
|
||||
this.setup_logout();
|
||||
}
|
||||
|
||||
// Options
|
||||
// ----------------------------------------------------------------------------------------
|
||||
this.setup_options = function() {
|
||||
var tm = this.menu.add_top_menu('Pages', function() { }, "sprite-pages");
|
||||
|
||||
var fn = function() {
|
||||
if(this.dt=='Page')
|
||||
loadpage(this.dn);
|
||||
else
|
||||
loaddoc(this.dt, this.dn);
|
||||
mclose();
|
||||
}
|
||||
|
||||
// add start items
|
||||
profile.start_items.sort(function(a,b){return (a[4]-b[4])});
|
||||
for(var i=0;i< profile.start_items.length;i++) {
|
||||
var d = profile.start_items[i];
|
||||
var mi = this.menu.add_item('Pages',d[1], fn);
|
||||
mi.dt = d[0]; mi.dn = d[5]?d[5]:d[1];
|
||||
}
|
||||
}
|
||||
|
||||
// Home
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
this.setup_home = function() {
|
||||
me.menu.add_top_menu('Home', function() { loadpage(home_page); }, "sprite-home");
|
||||
}
|
||||
|
||||
// Recent
|
||||
// ----------------------------------------------------------------------------------------
|
||||
this.setup_recent = function() {
|
||||
|
||||
this.rdocs = me.menu.add_top_menu('Recent', function() { }, "sprite-recent");
|
||||
this.rdocs.items = {};
|
||||
|
||||
var fn = function() { // recent is only for forms
|
||||
loaddoc(this.dt, this.dn);
|
||||
mclose();
|
||||
}
|
||||
|
||||
// add to recent
|
||||
this.rdocs.add = function(dt, dn, on_top) {
|
||||
var has_parent = false;
|
||||
if(locals[dt] && locals[dt][dn] && locals[dt][dn].parent) has_parent = true;
|
||||
|
||||
if(!in_list(['Start Page','ToDo Item','Event','Search Criteria'], dt) && !has_parent) {
|
||||
|
||||
// if there in list, only bring it to top
|
||||
if(this.items[dt+'-'+dn]) {
|
||||
var mi = this.items[dt+'-'+dn];
|
||||
mi.bring_to_top();
|
||||
return;
|
||||
}
|
||||
|
||||
var tdn = dn;
|
||||
var rec_label = '<table style="width: 100%" cellspacing=0><tr>'
|
||||
+'<td style="width: 10%; vertical-align: middle;"><div class="status_flag" id="rec_'+dt+'-'+dn+'"></div></td>'
|
||||
+'<td style="width: 50%; text-decoration: underline; color: #22B; padding: 2px;">'+tdn+'</td>'
|
||||
+'<td style="font-size: 11px;">'+get_doctype_label(dt)+'</td></tr></table>';
|
||||
|
||||
var mi = me.menu.add_item('Recent',rec_label,fn, on_top);
|
||||
mi.dt = dt; mi.dn = dn;
|
||||
this.items[dt+'-'+dn] = mi;
|
||||
if(pscript.on_recent_update)pscript.on_recent_update();
|
||||
}
|
||||
}
|
||||
|
||||
// remove from recent
|
||||
this.rdocs.remove = function(dt, dn) {
|
||||
var it = me.rdocs.items[dt+'-'+dn];
|
||||
if(it)$dh(it);
|
||||
if(pscript.on_recent_update)pscript.on_recent_update();
|
||||
}
|
||||
|
||||
this.rename_notify = function(dt, old, name) {
|
||||
me.rdocs.remove(dt, old);
|
||||
me.rdocs.add(dt, name, 1);
|
||||
}
|
||||
rename_observers.push(this);
|
||||
|
||||
// add menu items
|
||||
try{ var rlist = JSON.parse(profile.recent); }
|
||||
catch(e) { return; /*old style-do nothing*/ }
|
||||
|
||||
var m = rlist.length;
|
||||
if(m>15)m=15;
|
||||
for (var i=0;i<m;i++) {
|
||||
var rd = rlist[i]
|
||||
if(rd[1]) {
|
||||
var dt = rd[0]; var dn = rd[1];
|
||||
this.rdocs.add(dt, dn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Tools
|
||||
// ----------------------------------------------------------------------------------------
|
||||
this.setup_help = function() {
|
||||
me.menu.add_top_menu('Tools', function() { }, "sprite-tools");
|
||||
this.menu.add_item('Tools','Error Console', function() { err_console.show(); });
|
||||
this.menu.add_item('Tools','Clear Cache', function() {
|
||||
localStorage.clear();
|
||||
$c('webnotes.session_cache.clear',{},function(r,rt){ show_alert(r.message); });
|
||||
});
|
||||
if(has_common(user_roles,['Administrator','System Manager'])) {
|
||||
this.menu.add_item('Tools','Download Backup', function() { me.download_backup(); });
|
||||
}
|
||||
this.menu.add_item('Tools','Web Notes Framework', function() { show_about(); });
|
||||
}
|
||||
|
||||
// New
|
||||
// ----------------------------------------------------------------------------------------
|
||||
this.setup_new = function() {
|
||||
me.menu.add_top_menu('New', function() { me.show_new(); }, 'sprite-new' );
|
||||
me.show_new = function() {
|
||||
if(!me.new_dialog) {
|
||||
var d = new Dialog(240, 140, "Create a new record");
|
||||
d.make_body(
|
||||
[['HTML','Select']
|
||||
,['Button','Go', function() { me.new_dialog.hide(); new_doc(me.new_sel.inp.value); }]]);
|
||||
d.onshow = function(){
|
||||
me.new_sel.inp.focus();
|
||||
}
|
||||
me.new_dialog = d;
|
||||
|
||||
// replace by labels
|
||||
var nl = profile.can_create.join(',').split(',');
|
||||
for(var i=0;i<nl.length;i++) nl[i]=get_doctype_label(nl[i]);
|
||||
|
||||
// labels
|
||||
me.new_sel = new SelectWidget(d.widgets['Select'], nl.sort(), '200px');
|
||||
me.new_sel.onchange = function() { me.new_dialog.hide(); new_doc(me.new_sel.inp.value); }
|
||||
}
|
||||
me.new_dialog.show();
|
||||
}
|
||||
|
||||
//this.new_sel.inp.onchange = function() { new_doc(me.new_sel.inp.value); this.value = 'Create New...'; }
|
||||
}
|
||||
|
||||
// Report Builder
|
||||
// ----------------------------------------------------------------------------------------
|
||||
this.setup_report_builder = function() {
|
||||
me.menu.add_top_menu('Report', function() { me.show_rb(); }, 'sprite-report' );
|
||||
me.show_rb = function() {
|
||||
if(!me.rb_dialog) {
|
||||
var d = new Dialog(240, 140, "Build a report for");
|
||||
d.make_body(
|
||||
[['HTML','Select']
|
||||
,['Button','Go', function() { me.rb_dialog.hide(); loadreport(me.rb_sel.inp.value, null, null, null, 1); }]]);
|
||||
d.onshow = function(){
|
||||
me.rb_sel.inp.focus();
|
||||
}
|
||||
me.rb_dialog = d;
|
||||
|
||||
// replace by labels
|
||||
var nl = profile.can_get_report.join(',').split(',');
|
||||
for(var i=0;i<nl.length;i++) nl[i]=get_doctype_label(nl[i]);
|
||||
|
||||
me.rb_sel = new SelectWidget(d.widgets['Select'], nl.sort(), '200px');
|
||||
me.rb_sel.onchange = function() { me.rb_dialog.hide(); loadreport(me.rb_sel.inp.value, null, null, null, 1); };
|
||||
}
|
||||
me.rb_dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
// Setup Search
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
this.setup_search = function() {
|
||||
|
||||
me.menu.add_top_menu('Search', function() { me.search_dialog.show(); }, 'sprite-search' );
|
||||
|
||||
// make the dialog
|
||||
// ----------------
|
||||
var d = new Dialog(240, 140, "Quick Search");
|
||||
d.make_body(
|
||||
[['HTML','Select']
|
||||
,['Button','Go', function() { me.open_quick_search(); }]]);
|
||||
d.onshow = function(){
|
||||
me.search_sel.inp.focus();
|
||||
}
|
||||
me.search_dialog = d;
|
||||
|
||||
// enter key
|
||||
keypress_observers.push({notify_keypress: function(ev, keycode) {
|
||||
if(keycode==13 && me.search_dialog.display) me.open_quick_search();
|
||||
}});
|
||||
|
||||
|
||||
// select
|
||||
me.search_sel = new SelectWidget(d.widgets['Select'], [], '120px');
|
||||
me.search_sel.inp.value = 'Select...';
|
||||
|
||||
me.open_quick_search = function() {
|
||||
me.search_dialog.hide();
|
||||
var v = sel_val(me.search_sel);
|
||||
if(v) selector.set_search(v);
|
||||
me.search_sel.disabled = 1;
|
||||
selector.show();
|
||||
}
|
||||
|
||||
// replace by labels
|
||||
var nl = profile.can_read.join(',').split(',');
|
||||
|
||||
for(var i=0;i<nl.length;i++) nl[i]=get_doctype_label(nl[i]);
|
||||
|
||||
me.search_sel.set_options(nl.sort());
|
||||
me.search_sel.onchange = function() { me.open_quick_search(); }
|
||||
|
||||
// make the selector dialog
|
||||
makeselector();
|
||||
}
|
||||
|
||||
// Setup User / Logout area
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
this.setup_logout = function() {
|
||||
|
||||
var w = $a($td(this.body_tab, 0, 2),'div','',{paddingTop:'2px', textAlign:'right'});
|
||||
this.right_table_style = {fontSize:'11px',verticalAlign:'middle',height:'20px',paddingLeft:'4px',paddingRight:'4px'};
|
||||
var t = make_table(w, 1, 6, null, [], this.right_table_style);
|
||||
|
||||
$y(t,{cssFloat:'right', color:'#FFF'});
|
||||
$td(t,0,0).innerHTML = '<a style="cursor: pointer; font-weight: bold; color: #FFF; text-decoration: underline" onclick="get_help()">Help</a>';
|
||||
$td(t,0,4).innerHTML = '<span style="cursor: pointer; font-weight: bold; color: #FFF;" onclick="logout()">Logout</span>';
|
||||
this.menu_table_right = t;
|
||||
$y($td(t,0,5), {width:'18px'});
|
||||
this.spinner = $a($td(t,0,5),'img','',{display:'none'}); this.spinner.src = 'lib/images/ui/spinner.gif';
|
||||
}
|
||||
|
||||
this.download_backup = function() {
|
||||
$c('webnotes.utils.backups.get_backup',{},function(r,rt) {});
|
||||
}
|
||||
|
||||
this.setup();
|
||||
}
|
||||
|
||||
var get_help = function() {
|
||||
msgprint('Help not implemented');
|
||||
}
|
||||
|
||||
var get_feedback = function() {
|
||||
// dialog
|
||||
var d = new Dialog(640, 320, "Please give your feedback");
|
||||
d.make_body(
|
||||
[['Text','Feedback']
|
||||
,['Button','Send', function() {
|
||||
$c_obj('Feedback Control', 'get_feedback', d.widgets['Feedback'].value, function(r,rt) {
|
||||
d.hide(); if(r.message) msgprint(r.message);
|
||||
})
|
||||
} ]]
|
||||
);
|
||||
d.show();
|
||||
|
||||
// send to Feedback Control
|
||||
}
|
||||
|
|
@ -541,7 +541,7 @@ _f.Frm.prototype.refresh_header = function() {
|
|||
if(this.frm_head)this.frm_head.refresh_toolbar();
|
||||
|
||||
// add to recent
|
||||
if(page_body.wntoolbar) page_body.wntoolbar.rdocs.add(this.doctype, this.docname, 1);
|
||||
if(wn.ui.toolbar.recent) wn.ui.toolbar.recent.add(this.doctype, this.docname, 1);
|
||||
|
||||
// refresh_heading - status etc.
|
||||
this.set_heading();
|
||||
|
|
@ -1145,7 +1145,7 @@ _f.Frm.prototype.savetrash = function() {
|
|||
LocalDB.delete_doc(me.doctype, me.docname);
|
||||
|
||||
// delete from recent
|
||||
if(page_body.wntoolbar) page_body.wntoolbar.rdocs.remove(me.doctype, me.docname);
|
||||
if(wn.ui.toolbar.recent) wn.ui.toolbar.recent.remove(me.doctype, me.docname);
|
||||
|
||||
// "close"
|
||||
nav_obj.show_last_open();
|
||||
|
|
|
|||
|
|
@ -1,195 +0,0 @@
|
|||
// Menu Bar
|
||||
|
||||
function MenuToolbar(parent) {
|
||||
this.ul = $a(parent, 'ul', 'menu_toolbar');
|
||||
this.cur_top_menu = null;
|
||||
this.max_rows = 10;
|
||||
this.dropdown_width = '280px';
|
||||
this.top_menus = {};
|
||||
|
||||
this.top_menu_style = 'top_menu';
|
||||
this.top_menu_mo_style = 'top_menu_mo';
|
||||
this.top_menu_icon_style = 'top_menu_icon';
|
||||
|
||||
}
|
||||
MenuToolbar.prototype.add_top_menu = function(label, onclick, add_icon) {
|
||||
var li = $a(this.ul, 'li');
|
||||
|
||||
li.item = new MenuToolbarItem(this, li, label, onclick, add_icon);
|
||||
|
||||
this.top_menus[label] = li.item.wrapper;
|
||||
return li.item.wrapper;
|
||||
}
|
||||
|
||||
function MenuToolbarItem(tbar, parent, label, onclick, add_icon) {
|
||||
var me = this;
|
||||
this.wrapper = $a(parent, 'div', tbar.top_menu_style);
|
||||
|
||||
// add icon
|
||||
if(add_icon) {
|
||||
var t = make_table(this.wrapper, 1, 2, null, ['22px', null], {verticalAlign:'middle'});
|
||||
$y(t,{borderCollapse:'collapse'});
|
||||
var icon = $a($td(t,0,0), 'div', 'wntoolbar-icon ' + add_icon);
|
||||
$td(t,0,1).innerHTML = label;
|
||||
} else {
|
||||
this.wrapper.innerHTML = label;
|
||||
}
|
||||
|
||||
this.wrapper.onclick = function() { onclick(); };
|
||||
this.def_class = tbar.top_menu_style;
|
||||
|
||||
// mouseovers
|
||||
this.wrapper.onmouseover = function() {
|
||||
this.set_selected();
|
||||
if(this.my_mouseover)this.my_mouseover(this);
|
||||
}
|
||||
this.wrapper.onmouseout = function() {
|
||||
if(this.my_mouseout)
|
||||
this.my_mouseout(this);
|
||||
this.set_unselected();
|
||||
}
|
||||
|
||||
// select / unselect
|
||||
this.wrapper.set_unselected = function() {
|
||||
if(me.wrapper.dropdown && me.wrapper.dropdown.is_active) {
|
||||
return;
|
||||
}
|
||||
me.wrapper.className = me.def_class;
|
||||
}
|
||||
this.wrapper.set_selected = function() {
|
||||
if(me.cur_top_menu)
|
||||
me.cur_top_menu.set_unselected();
|
||||
me.wrapper.className = me.def_class + ' '+tbar.top_menu_mo_style;
|
||||
me.cur_top_menu = this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
var closetimer;
|
||||
function mclose(opt) { // close all active
|
||||
for(var i=0;i<all_dropdowns.length;i++) {
|
||||
if(all_dropdowns[i].is_active)
|
||||
if(opt && opt==all_dropdowns[i]) { /* don't hide caller */ }
|
||||
else all_dropdowns[i].hide();
|
||||
}
|
||||
}
|
||||
function mclosetime() { closetimer = window.setTimeout(mclose, 700); }
|
||||
function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } }
|
||||
|
||||
MenuToolbar.prototype.make_dropdown = function(tm) {
|
||||
var me = this;
|
||||
tm.dropdown = new DropdownMenu(tm, this.dropdown_width);
|
||||
|
||||
// triggers on top menu
|
||||
tm.my_mouseover = function() {
|
||||
this.dropdown.show();
|
||||
}
|
||||
tm.my_mouseout = function() {
|
||||
this.dropdown.clear();
|
||||
}
|
||||
}
|
||||
|
||||
MenuToolbar.prototype.add_item = function(top_menu_label, label, onclick, on_top) {
|
||||
var me = this;
|
||||
var tm = this.top_menus[top_menu_label];
|
||||
if(!tm.dropdown)
|
||||
this.make_dropdown(tm, this.dropdown_width);
|
||||
|
||||
return tm.dropdown.add_item(label, onclick, on_top);
|
||||
}
|
||||
|
||||
var all_dropdowns = []; var cur_dropdown;
|
||||
function DropdownMenu(parent, width) {
|
||||
this.body = $a(parent, 'div', 'menu_toolbar_dropdown', {width:(width ? width : '140px'), display:'none'});
|
||||
this.parent = parent;
|
||||
this.items = {};
|
||||
this.item_style = 'dd_item';
|
||||
this.item_mo_style = 'dd_item_mo';
|
||||
this.list = [];
|
||||
this.max_height = 400;
|
||||
this.keypressdelta = 500;
|
||||
|
||||
var me = this;
|
||||
|
||||
this.body.onmouseout = function() { me.clear(); }
|
||||
this.body.onmouseover = function() {
|
||||
mcancelclosetime();
|
||||
} // re-entered
|
||||
this.clear_user_inp = function() { me.user_inp = '';}
|
||||
|
||||
this.show = function() {
|
||||
// close others
|
||||
mclose(me);
|
||||
|
||||
// clear menu timeout
|
||||
mcancelclosetime();
|
||||
|
||||
me.is_active = 1;
|
||||
|
||||
$ds(me.body); // show
|
||||
|
||||
if(cint(me.body.clientHeight) >= me.max_height) {
|
||||
$y(me.body, {height:me.max_height + 'px'});
|
||||
me.scrollbars = 1;
|
||||
} else {
|
||||
$y(me.body, {height:null});
|
||||
me.scrollbars = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.hide = function() {
|
||||
$dh(me.body);
|
||||
|
||||
// clear from active list
|
||||
me.is_active = 0;
|
||||
|
||||
// events on label
|
||||
if(me.parent && me.parent.set_unselected) {
|
||||
me.parent.set_unselected();
|
||||
}
|
||||
}
|
||||
|
||||
this.clear = function() {
|
||||
mcancelclosetime();
|
||||
mclosetime();
|
||||
}
|
||||
all_dropdowns.push(me);
|
||||
}
|
||||
|
||||
DropdownMenu.prototype.add_item = function(label, onclick, on_top) {
|
||||
var me = this;
|
||||
|
||||
if(on_top) {
|
||||
var mi = document.createElement('div');
|
||||
me.body.insertBefore(mi, me.body.firstChild);
|
||||
mi.className = this.item_style;
|
||||
} else {
|
||||
var mi = $a(this.body, 'div', this.item_style);
|
||||
}
|
||||
|
||||
mi.innerHTML = label;
|
||||
mi.label = label;
|
||||
mi.my_onclick = onclick;
|
||||
mi.onclick = function() { mclose(); this.my_onclick(); };
|
||||
|
||||
mi.highlight = function() {
|
||||
if(me.cur_mi) me.cur_mi.clear();
|
||||
this.className = me.item_style + ' ' + me.item_mo_style;
|
||||
me.cur_mi=this;
|
||||
}
|
||||
mi.clear = function() {
|
||||
this.className = me.item_style;
|
||||
}
|
||||
|
||||
mi.onmouseover = mi.highlight;
|
||||
mi.onmouseout = mi.clear;
|
||||
|
||||
mi.bring_to_top = function() { me.body.insertBefore(this, me.body.firstChild); }
|
||||
|
||||
//var k=0, e=mi;
|
||||
//while (e = e.previousSibling) { ++k;}
|
||||
|
||||
//mi.idx = k;
|
||||
return mi;
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
wn.widgets.FieldGroup = function() {
|
||||
|
||||
this.make_fields = function(body, fl) {
|
||||
wn.require('lib/js/legacy/widgets/form/fields.js');
|
||||
$y(this.body, {padding:'11px'});
|
||||
this.fields_dict = {}; // reset
|
||||
for(var i=0; i<fl.length; i++) {
|
||||
|
|
@ -60,7 +61,10 @@ wn.widgets.Dialog = function(opts) {
|
|||
this.display = false;
|
||||
|
||||
this.make = function(opts) {
|
||||
if(opts) this.opts = opts;
|
||||
if(opts)
|
||||
this.opts = opts;
|
||||
if(!this.opts.width) this.opts.width = 480;
|
||||
|
||||
this.wrapper = $a(popup_cont, 'div', 'dialog_wrapper');
|
||||
|
||||
if(this.opts.width)
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ function _getMarkup(element,opts){var $element=$(element);var elementHtml=_getEl
|
|||
html.push('<link type="text/css" rel="stylesheet" href="'+current+'" >');else
|
||||
html.push('<link type="text/css" rel="stylesheet" href="'+current["href"]+'" media="'+current["media"]+'" >');}}}
|
||||
else{$("link",document).filter(function(){return $(this).attr("rel").toLowerCase()=="stylesheet";}).each(function(){html.push('<link type="text/css" rel="stylesheet" href="'+$(this).attr("href")+'" media="'+$(this).attr('media')+'" >');});}
|
||||
html.push('<base href="'+_getBaseHref()+'" />');html.push('</head><body style="'+opts["printBodyOptions"]["styleToAdd"]+'" class="'+opts["printBodyOptions"]["classNameToAdd"]+'">');html.push('<div class="'+$element.attr('class')+'">'+elementHtml+'</div>');html.push('<script type="text/javascript">function printPage(){focus();print();'+((!$.browser.opera&&!opts["leaveOpen"]&&opts["printMode"].toLowerCase()=='popup')?'close();':'')+'}</script>');html.push('</body></html>');return html.join('');};})(window);wn.widgets.FieldGroup=function(){this.make_fields=function(body,fl){$y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;i<fl.length;i++){var df=fl[i];var div=$a(body,'div','',{margin:'6px 0px'})
|
||||
html.push('<base href="'+_getBaseHref()+'" />');html.push('</head><body style="'+opts["printBodyOptions"]["styleToAdd"]+'" class="'+opts["printBodyOptions"]["classNameToAdd"]+'">');html.push('<div class="'+$element.attr('class')+'">'+elementHtml+'</div>');html.push('<script type="text/javascript">function printPage(){focus();print();'+((!$.browser.opera&&!opts["leaveOpen"]&&opts["printMode"].toLowerCase()=='popup')?'close();':'')+'}</script>');html.push('</body></html>');return html.join('');};})(window);wn.widgets.FieldGroup=function(){this.make_fields=function(body,fl){wn.require('lib/js/legacy/widgets/form/fields.js');$y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;i<fl.length;i++){var df=fl[i];var div=$a(body,'div','',{margin:'6px 0px'})
|
||||
f=make_field(df,null,div,null);f.not_in_form=1;this.fields_dict[df.fieldname]=f
|
||||
f.refresh();}}
|
||||
this.get_values=function(){var ret={};var errors=[];for(var key in this.fields_dict){var f=this.fields_dict[key];var v=f.get_value?f.get_value():null;if(f.df.reqd&&!v)
|
||||
|
|
@ -308,7 +308,8 @@ if(errors.length){msgprint('<b>Please check the following Errors</b>\n'+errors.j
|
|||
return ret;}
|
||||
this.set_value=function(key,val){var f=this.fields_dict[key];if(f){f.set_input(val);f.refresh_mandatory();}}
|
||||
this.set_values=function(dict){for(var key in dict){if(this.fields_dict[key]){this.set_value(key,dict[key]);}}}}
|
||||
wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=function(opts){if(opts)this.opts=opts;this.wrapper=$a(popup_cont,'div','dialog_wrapper');if(this.opts.width)
|
||||
wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=function(opts){if(opts)
|
||||
this.opts=opts;if(!this.opts.width)this.opts.width=480;this.wrapper=$a(popup_cont,'div','dialog_wrapper');if(this.opts.width)
|
||||
this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields)
|
||||
this.make_fields(this.body,this.opts.fields);}
|
||||
this.make_head=function(){var me=this;this.head=$a(this.wrapper,'div','dialog_head');var t=make_table(this.head,1,2,'100%',['100%','16px'],{padding:'2px'});$y($td(t,0,0),{paddingLeft:'16px',fontWeight:'bold',fontSize:'14px',textAlign:'center'});$y($td(t,0,1),{textAlign:'right'});var img=$a($td(t,0,01),'img','',{cursor:'pointer'});img.src='lib/images/icons/close.gif';this.title_text=$td(t,0,0);this.set_title(this.opts.title);img.onclick=function(){if(me.oncancel)me.oncancel();me.hide();}
|
||||
|
|
@ -477,37 +478,6 @@ this.label.onclick=function(e){me.select();}
|
|||
this.label.ondblclick=function(e){me.select();if(me.ondblclick)me.ondblclick(me);}
|
||||
this.clear_child_nodes=function(){if(this.tab){this.tab.parentNode.removeChild(this.tab);delete this.tab;}
|
||||
this.expanded_once=0;}}
|
||||
function MenuToolbar(parent){this.ul=$a(parent,'ul','menu_toolbar');this.cur_top_menu=null;this.max_rows=10;this.dropdown_width='280px';this.top_menus={};this.top_menu_style='top_menu';this.top_menu_mo_style='top_menu_mo';this.top_menu_icon_style='top_menu_icon';}
|
||||
MenuToolbar.prototype.add_top_menu=function(label,onclick,add_icon){var li=$a(this.ul,'li');li.item=new MenuToolbarItem(this,li,label,onclick,add_icon);this.top_menus[label]=li.item.wrapper;return li.item.wrapper;}
|
||||
function MenuToolbarItem(tbar,parent,label,onclick,add_icon){var me=this;this.wrapper=$a(parent,'div',tbar.top_menu_style);if(add_icon){var t=make_table(this.wrapper,1,2,null,['22px',null],{verticalAlign:'middle'});$y(t,{borderCollapse:'collapse'});var icon=$a($td(t,0,0),'div','wntoolbar-icon '+add_icon);$td(t,0,1).innerHTML=label;}else{this.wrapper.innerHTML=label;}
|
||||
this.wrapper.onclick=function(){onclick();};this.def_class=tbar.top_menu_style;this.wrapper.onmouseover=function(){this.set_selected();if(this.my_mouseover)this.my_mouseover(this);}
|
||||
this.wrapper.onmouseout=function(){if(this.my_mouseout)
|
||||
this.my_mouseout(this);this.set_unselected();}
|
||||
this.wrapper.set_unselected=function(){if(me.wrapper.dropdown&&me.wrapper.dropdown.is_active){return;}
|
||||
me.wrapper.className=me.def_class;}
|
||||
this.wrapper.set_selected=function(){if(me.cur_top_menu)
|
||||
me.cur_top_menu.set_unselected();me.wrapper.className=me.def_class+' '+tbar.top_menu_mo_style;me.cur_top_menu=this;}}
|
||||
var closetimer;function mclose(opt){for(var i=0;i<all_dropdowns.length;i++){if(all_dropdowns[i].is_active)
|
||||
if(opt&&opt==all_dropdowns[i]){}
|
||||
else all_dropdowns[i].hide();}}
|
||||
function mclosetime(){closetimer=window.setTimeout(mclose,700);}
|
||||
function mcancelclosetime(){if(closetimer){window.clearTimeout(closetimer);closetimer=null;}}
|
||||
MenuToolbar.prototype.make_dropdown=function(tm){var me=this;tm.dropdown=new DropdownMenu(tm,this.dropdown_width);tm.my_mouseover=function(){this.dropdown.show();}
|
||||
tm.my_mouseout=function(){this.dropdown.clear();}}
|
||||
MenuToolbar.prototype.add_item=function(top_menu_label,label,onclick,on_top){var me=this;var tm=this.top_menus[top_menu_label];if(!tm.dropdown)
|
||||
this.make_dropdown(tm,this.dropdown_width);return tm.dropdown.add_item(label,onclick,on_top);}
|
||||
var all_dropdowns=[];var cur_dropdown;function DropdownMenu(parent,width){this.body=$a(parent,'div','menu_toolbar_dropdown',{width:(width?width:'140px'),display:'none'});this.parent=parent;this.items={};this.item_style='dd_item';this.item_mo_style='dd_item_mo';this.list=[];this.max_height=400;this.keypressdelta=500;var me=this;this.body.onmouseout=function(){me.clear();}
|
||||
this.body.onmouseover=function(){mcancelclosetime();}
|
||||
this.clear_user_inp=function(){me.user_inp='';}
|
||||
this.show=function(){mclose(me);mcancelclosetime();me.is_active=1;$ds(me.body);if(cint(me.body.clientHeight)>=me.max_height){$y(me.body,{height:me.max_height+'px'});me.scrollbars=1;}else{$y(me.body,{height:null});me.scrollbars=0;}}
|
||||
this.hide=function(){$dh(me.body);me.is_active=0;if(me.parent&&me.parent.set_unselected){me.parent.set_unselected();}}
|
||||
this.clear=function(){mcancelclosetime();mclosetime();}
|
||||
all_dropdowns.push(me);}
|
||||
DropdownMenu.prototype.add_item=function(label,onclick,on_top){var me=this;if(on_top){var mi=document.createElement('div');me.body.insertBefore(mi,me.body.firstChild);mi.className=this.item_style;}else{var mi=$a(this.body,'div',this.item_style);}
|
||||
mi.innerHTML=label;mi.label=label;mi.my_onclick=onclick;mi.onclick=function(){mclose();this.my_onclick();};mi.highlight=function(){if(me.cur_mi)me.cur_mi.clear();this.className=me.item_style+' '+me.item_mo_style;me.cur_mi=this;}
|
||||
mi.clear=function(){this.className=me.item_style;}
|
||||
mi.onmouseover=mi.highlight;mi.onmouseout=mi.clear;mi.bring_to_top=function(){me.body.insertBefore(this,me.body.firstChild);}
|
||||
return mi;}
|
||||
function Layout(parent,width){if(parent&&parent.substr){parent=$i(parent);}
|
||||
this.wrapper=$a(parent,'div','',{display:'none'});if(width){this.width=this.wrapper.style.width;}
|
||||
this.myrows=[];}
|
||||
|
|
@ -659,8 +629,7 @@ inp.value='';if(d.input&&d.input.txt.value){inp.value=d.input.txt.value;}
|
|||
try{inp.focus();}catch(e){}
|
||||
if(d.input)d.input.set_get_query();var get_sf_list=function(dt){var l=[];var lf=search_fields[dt];for(var i=0;i<lf.length;i++)l.push(lf[i][1]);return l;}
|
||||
$ds(d.rows['Search By']);if(search_fields[d.sel_type]){empty_select(field_sel);add_sel_options(field_sel,get_sf_list(d.sel_type),'ID');}else{empty_select(field_sel);add_sel_options(field_sel,['ID'],'ID');$c('webnotes.widgets.search.getsearchfields',{'doctype':d.sel_type},function(r,rt){search_fields[d.sel_type]=r.searchfields;empty_select(field_sel);add_sel_options(field_sel,get_sf_list(d.sel_type));field_sel.selectedIndex=0;});}}
|
||||
d.onhide=function(){if(page_body.wntoolbar)
|
||||
page_body.wntoolbar.search_sel.disabled=0;if(d.input&&d.input.txt)
|
||||
d.onhide=function(){if(d.input&&d.input.txt)
|
||||
d.input.txt.onchange()}
|
||||
btn.onclick=function(){if(this.disabled)return;this.set_working();d.set_doctype=d.sel_type;var q='';args={};if(d.input&&d.input.get_query){var doc={};args.is_simple=1;if(cur_frm)doc=locals[cur_frm.doctype][cur_frm.docname];var q=d.input.get_query(doc,d.input.doctype,d.input.docname);if(!q){return'';}}
|
||||
var get_sf_fieldname=function(v){var lf=search_fields[d.sel_type];if(!lf)
|
||||
|
|
@ -676,9 +645,8 @@ l.onclick=function(){loaddoc(this.dt,this.link_name);d.hide();}
|
|||
var cl=[]
|
||||
for(var j=1;j<r.values[i].length;j++)cl.push(r.values[i][j]);var c=$a(div,'div','comment',{marginTop:'2px'});c.innerHTML=cl.join(', ');}}
|
||||
selector=d;}
|
||||
var _loading_div;function set_loading(){if(page_body.wntoolbar)$ds(page_body.wntoolbar.spinner);$y(document.getElementsByTagName('body')[0],{cursor:'progress'});if(page_body.on_start_spinner)page_body.on_start_spinner();pending_req++;}
|
||||
function hide_loading(){pending_req--;if(!pending_req){$y(document.getElementsByTagName('body')[0],{cursor:'default'});if(page_body.wntoolbar)
|
||||
var d=page_body.wntoolbar.spinner;if(d)$dh(d);if(page_body.on_stop_spinner)page_body.on_stop_spinner();}}
|
||||
function set_loading(){pending_req++;$('#spinner').css('visibility','visible');$('body').css('cursor','progress');}
|
||||
function hide_loading(){pending_req--;if(!pending_req){$('body').css('cursor','default');$('#spinner').css('visibility','hidden');}}
|
||||
var fcount=0;var frozen=0;var dialog_message;var dialog_back;function freeze(msg,do_freeze){if(!dialog_back){dialog_back=$a($i('body_div'),'div','dialog_back');if(isIE)dialog_back.style['filter']='alpha(opacity=60)';}
|
||||
$ds(dialog_back);$y(dialog_back,{height:$(document).height()+'px'});fcount++;frozen=1;}
|
||||
function unfreeze(){if(dialog_message)
|
||||
|
|
@ -878,8 +846,8 @@ this.run_startup_code=function(){if(this.cp.startup_css)
|
|||
set_style(this.cp.startup_css);try{if(this.cp.startup_code)
|
||||
eval(this.cp.startup_code);if(this.cp.custom_startup_code)
|
||||
eval(this.cp.custom_startup_code);}catch(e){errprint(e);}}
|
||||
this.setup=function(){this.cp=locals['Control Panel']['Control Panel'];this.wntoolbar_area=$a($i('body_div'),'div');this.wrapper=$a($i('body_div'),'div');this.banner_area=$a(this.wrapper,'div');;this.topmenu=$a(this.wrapper,'div');this.breadcrumbs=$a(this.wrapper,'div');this.body=$a(this.wrapper,'div');this.footer=$a(this.wrapper,'div');if(user_defaults.hide_sidebars){this.cp.left_sidebar_width=null;this.cp.right_sidebar_width=null;}
|
||||
this.setup_page_areas();this.setup_header_footer();if(user=='Guest')user_defaults.hide_webnotes_toolbar=1;if(!cint(user_defaults.hide_webnotes_toolbar)||user=='Administrator'){wn.require('lib/js/legacy/webpage/wntoolbar.js');this.wntoolbar=new WNToolbar(this.wntoolbar_area);$y(this.wrapper,{marginTop:this.wntoolbar.wrapper.offsetHeight+'px'});}
|
||||
this.setup=function(){this.cp=locals['Control Panel']['Control Panel'];this.wrapper=$a($i('body_div'),'div');this.banner_area=$a(this.wrapper,'div');;this.topmenu=$a(this.wrapper,'div');this.breadcrumbs=$a(this.wrapper,'div');this.body=$a(this.wrapper,'div');this.footer=$a(this.wrapper,'div');if(user_defaults.hide_sidebars){this.cp.left_sidebar_width=null;this.cp.right_sidebar_width=null;}
|
||||
this.setup_page_areas();this.setup_header_footer();if(user=='Guest')user_defaults.hide_webnotes_toolbar=1;if(!cint(user_defaults.hide_webnotes_toolbar)||user=='Administrator'){wn.require('lib/js/wn/ui/toolbar/toolbar.js');this.wntoolbar=new wn.ui.toolbar.Toolbar();}
|
||||
if(this.cp.page_width)$y(this.wrapper,{width:cint(this.cp.page_width)+'px'});}
|
||||
this.pages={};this.cur_page=null;this.add_page=function(label,onshow,onhide){var c=$a(this.center.body,'div');if(onshow)
|
||||
c.onshow=onshow;if(onhide)
|
||||
|
|
@ -924,9 +892,8 @@ window.onscroll=function(){for(var i=0;i<scroll_list.length;i++){scroll_list[i](
|
|||
var resize_observers=[]
|
||||
function set_resize_observer(fn){if(resize_observers.indexOf(fn)==-1)resize_observers.push(fn);}
|
||||
window.onresize=function(){return;var ht=get_window_height();for(var i=0;i<resize_observers.length;i++){resize_observers[i](ht);}}
|
||||
get_window_height=function(){var ht=window.innerHeight?window.innerHeight:document.documentElement.offsetHeight?document.documentElement.offsetHeight:document.body.offsetHeight;var toolbarh=page_body.wntoolbar?page_body.wntoolbar.wrapper.offsetHeight:0
|
||||
var bannerh=page_body.banner_area?page_body.banner_area.offsetHeight:0
|
||||
get_window_height=function(){var ht=window.innerHeight?window.innerHeight:document.documentElement.offsetHeight?document.documentElement.offsetHeight:document.body.offsetHeight;var bannerh=page_body.banner_area?page_body.banner_area.offsetHeight:0
|
||||
var footerh=page_body.footer?page_body.footer.offsetHeight:0
|
||||
ht=ht-bannerh-toolbarh-footerh;return ht;}
|
||||
ht=ht-bannerh-footerh;return ht;}
|
||||
setup_space_holder=function(){window.space_holder_div=$a(null,'div','space_holder');window.space_holder_div.innerHTML='Loading...'}
|
||||
startup_list.push(setup_space_holder);
|
||||
|
|
@ -33,29 +33,18 @@ wn.assets = {
|
|||
}
|
||||
return src.split('.').slice(-1)[0];
|
||||
},
|
||||
|
||||
html_src: function(src) {
|
||||
if(src.indexOf('/')!=-1) {
|
||||
var t = src.split('/').slice(0,-1);
|
||||
t.push('src');
|
||||
t = t.join('/') +'/' + a.split('/').slice(-1)[0];
|
||||
} else {
|
||||
var t = 'src/' + src;
|
||||
}
|
||||
return t;
|
||||
},
|
||||
|
||||
// load an asset via
|
||||
// xmlhttp
|
||||
load: function(src) {
|
||||
// this is virtual page load, only get the the source
|
||||
// *without* the template
|
||||
var t = wn.assets.extn(src)=='html' ? wn.assets.html_src(src) : src;
|
||||
var t = src;
|
||||
|
||||
wn.xmlhttp.get(t, function(txt) {
|
||||
// add it to localstorage
|
||||
wn.assets.add(src, txt);
|
||||
}, 'q=' & Math.floor(Math.random()*1000) , false)
|
||||
}, 'q=' + Math.floor(Math.random()*1000) , false)
|
||||
},
|
||||
|
||||
// pass on to the handler to set
|
||||
|
|
@ -87,11 +76,6 @@ wn.assets = {
|
|||
}
|
||||
document.getElementsByTagName('head')[0].appendChild(se);
|
||||
},
|
||||
html: function(txt, src) {
|
||||
// make the html content page
|
||||
var page = wn.dom.add($('.outer .inner').get(0), 'div', 'content', null, txt);
|
||||
page.setAttribute("_src", src);
|
||||
},
|
||||
cgi: function(txt, src) {
|
||||
// dynamic content, will return content as
|
||||
// javascript
|
||||
|
|
|
|||
77
js/wn/class.js
Normal file
77
js/wn/class.js
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
|
||||
Inheritence "Class"
|
||||
-------------------
|
||||
see: http://ejohn.org/blog/simple-javascript-inheritance/
|
||||
To subclass, use:
|
||||
|
||||
var MyClass = Class.extend({
|
||||
init: function
|
||||
})
|
||||
|
||||
*/
|
||||
|
||||
/* Simple JavaScript Inheritance
|
||||
* By John Resig http://ejohn.org/
|
||||
* MIT Licensed.
|
||||
*/
|
||||
// Inspired by base2 and Prototype
|
||||
|
||||
(function(){
|
||||
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
|
||||
// The base Class implementation (does nothing)
|
||||
this.Class = function(){};
|
||||
|
||||
// Create a new Class that inherits from this class
|
||||
Class.extend = function(prop) {
|
||||
var _super = this.prototype;
|
||||
|
||||
// Instantiate a base class (but only create the instance,
|
||||
// don't run the init constructor)
|
||||
initializing = true;
|
||||
var prototype = new this();
|
||||
initializing = false;
|
||||
|
||||
// Copy the properties over onto the new prototype
|
||||
for (var name in prop) {
|
||||
// Check if we're overwriting an existing function
|
||||
prototype[name] = typeof prop[name] == "function" &&
|
||||
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
|
||||
(function(name, fn){
|
||||
return function() {
|
||||
var tmp = this._super;
|
||||
|
||||
// Add a new ._super() method that is the same method
|
||||
// but on the super-class
|
||||
this._super = _super[name];
|
||||
|
||||
// The method only need to be bound temporarily, so we
|
||||
// remove it when we're done executing
|
||||
var ret = fn.apply(this, arguments);
|
||||
this._super = tmp;
|
||||
|
||||
return ret;
|
||||
};
|
||||
})(name, prop[name]) :
|
||||
prop[name];
|
||||
}
|
||||
|
||||
// The dummy class constructor
|
||||
function Class() {
|
||||
// All construction is actually done in the init method
|
||||
if ( !initializing && this.init )
|
||||
this.init.apply(this, arguments);
|
||||
}
|
||||
|
||||
// Populate our constructed prototype object
|
||||
Class.prototype = prototype;
|
||||
|
||||
// Enforce the constructor to be what we expect
|
||||
Class.prototype.constructor = Class;
|
||||
|
||||
// And make this class extendable
|
||||
Class.extend = arguments.callee;
|
||||
|
||||
return Class;
|
||||
};
|
||||
})();
|
||||
19
js/wn/misc/about.js
Normal file
19
js/wn/misc/about.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// ABOUT
|
||||
|
||||
wn.provide('wn.ui.misc');
|
||||
wn.ui.misc.about = function() {
|
||||
if(!wn.ui.misc.about_dialog) {
|
||||
var d = new wn.widgets.Dialog({title:'About wnframework'})
|
||||
|
||||
$(d.body).html(repl("<div style='padding: 20px'<p><b>Application Name:</b> %(name)s</p>\
|
||||
<p><b>Version:</b> %(version)s</p>\
|
||||
<p><b>License:</b> %(license)s</p>\
|
||||
<p><b>Source Code:</b> %(source)s</p>\
|
||||
<p><b>Publisher:</b> %(publisher)s</p>\
|
||||
<p><b>Copyright:</b> %(copyright)s</p></div>", wn.app));
|
||||
|
||||
wn.ui.misc.about_dialog = d;
|
||||
}
|
||||
|
||||
wn.ui.misc.about_dialog.show();
|
||||
}
|
||||
16
js/wn/ui/toolbar/new.js
Normal file
16
js/wn/ui/toolbar/new.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
wn.ui.toolbar.NewDialog = wn.ui.toolbar.SelectorDialog.extend({
|
||||
init: function() {
|
||||
this._super({
|
||||
title: "New Record",
|
||||
execute: function(val) {
|
||||
new_doc(val);
|
||||
},
|
||||
});
|
||||
|
||||
// get new types
|
||||
this.set_values(profile.can_create.join(',').split(','));
|
||||
}
|
||||
});
|
||||
|
||||
wn.ui.toolbar.new_dialog = new wn.ui.toolbar.NewDialog();
|
||||
|
||||
49
js/wn/ui/toolbar/recent.js
Normal file
49
js/wn/ui/toolbar/recent.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
// recent document list
|
||||
wn.ui.toolbar.RecentDocs = Class.extend({
|
||||
init:function() {
|
||||
$('.topbar .nav:first').append('<li class="dropdown">\
|
||||
<a class="dropdown-toggle" href="#" onclick="return false;">Recent</a>\
|
||||
<ul class="dropdown-menu" id="toolbar-recent"></ul>\
|
||||
</li>');
|
||||
this.setup();
|
||||
this.bind_events();
|
||||
},
|
||||
bind_events: function() {
|
||||
rename_observers.push(this);
|
||||
},
|
||||
rename_notify: function(dt, old, name) {
|
||||
this.remove(dt, old);
|
||||
this.add(dt, name, 1);
|
||||
},
|
||||
add: function(dt, dn, on_top) {
|
||||
this.remove(dt, dn);
|
||||
var html = repl('<li data-docref="%(dt)s/%(dn)s">\
|
||||
<a href="#Form/%(dt)s/%(dn)s">\
|
||||
<span class="help">%(dt)s</span>: %(dn)s\
|
||||
</a></li>',
|
||||
{dt:dt, dn:dn});
|
||||
if(on_top) {
|
||||
$('#toolbar-recent').prepend(html);
|
||||
} else {
|
||||
$('#toolbar-recent').append(html);
|
||||
}
|
||||
},
|
||||
remove: function(dt, dn) {
|
||||
$(repl('#toolbar-recent li[data-docref="%(dt)s/%(dn)s"]', {dt:dt, dn:dn})).remove();
|
||||
},
|
||||
setup: function() {
|
||||
// add menu items
|
||||
try{ var rlist = JSON.parse(profile.recent); }
|
||||
catch(e) { return; /*old style-do nothing*/ }
|
||||
|
||||
var m = rlist.length;
|
||||
if(m>15)m=15;
|
||||
for (var i=0;i<m;i++) {
|
||||
var rd = rlist[i]
|
||||
if(rd[1]) {
|
||||
var dt = rd[0]; var dn = rd[1];
|
||||
this.add(dt, dn, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
15
js/wn/ui/toolbar/report.js
Normal file
15
js/wn/ui/toolbar/report.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
wn.ui.toolbar.Report = wn.ui.toolbar.SelectorDialog.extend({
|
||||
init: function() {
|
||||
this._super({
|
||||
title: "Start Report For",
|
||||
execute: function(val) {
|
||||
loadreport(val, null, null, null, 1);
|
||||
},
|
||||
});
|
||||
|
||||
// get new types
|
||||
this.set_values(profile.can_get_report.join(',').split(','));
|
||||
}
|
||||
});
|
||||
|
||||
wn.ui.toolbar.report = new wn.ui.toolbar.Report();
|
||||
19
js/wn/ui/toolbar/search.js
Normal file
19
js/wn/ui/toolbar/search.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
wn.ui.toolbar.Search = wn.ui.toolbar.SelectorDialog.extend({
|
||||
init: function() {
|
||||
this._super({
|
||||
title: "Search",
|
||||
execute: function(val) {
|
||||
selector.set_search(val);
|
||||
selector.show();
|
||||
},
|
||||
});
|
||||
|
||||
// get new types
|
||||
this.set_values(profile.can_read.join(',').split(','));
|
||||
|
||||
// global search selector
|
||||
makeselector();
|
||||
}
|
||||
});
|
||||
|
||||
wn.ui.toolbar.search = new wn.ui.toolbar.Search();
|
||||
59
js/wn/ui/toolbar/selector_dialog.js
Normal file
59
js/wn/ui/toolbar/selector_dialog.js
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
opts:
|
||||
|
||||
- title
|
||||
- execute
|
||||
|
||||
*/
|
||||
|
||||
wn.ui.toolbar.SelectorDialog = Class.extend({
|
||||
init: function(opts) {
|
||||
this.opts = opts;
|
||||
try{
|
||||
this.make_dialog();
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
}
|
||||
this.bind_events();
|
||||
},
|
||||
make_dialog: function() {
|
||||
this.dialog = new wn.widgets.Dialog({
|
||||
title: this.opts.title,
|
||||
width: 300,
|
||||
fields: [
|
||||
{fieldtype:'Select', fieldname:'doctype', options:'Select...', label:'Select Type'},
|
||||
{fieldtype:'Button', label:'Go', fieldname:'go'}
|
||||
]
|
||||
});
|
||||
},
|
||||
bind_events: function() {
|
||||
var me = this;
|
||||
|
||||
// on go
|
||||
$(this.dialog.fields_dict.go.input).click(function() {
|
||||
me.dialog.hide();
|
||||
me.opts.execute(me.dialog.fields_dict.doctype.get_value());
|
||||
});
|
||||
|
||||
// on change
|
||||
$(this.dialog.fields_dict.doctype.input).change(function() {
|
||||
me.dialog.hide();
|
||||
me.opts.execute($(this).val());
|
||||
});
|
||||
},
|
||||
show: function() {
|
||||
this.dialog.show();
|
||||
this.dialog.fields_dict.doctype.input.focus();
|
||||
return false;
|
||||
},
|
||||
set_values: function(lst) {
|
||||
// convert to labels
|
||||
for(var i=0;i<lst.length;i++)
|
||||
lst[i]=get_doctype_label(lst[i]);
|
||||
|
||||
// set values
|
||||
var sel = this.dialog.fields_dict.doctype.input;
|
||||
$(sel).empty();
|
||||
add_sel_options(sel, lst.sort());
|
||||
}
|
||||
})
|
||||
126
js/wn/ui/toolbar/toolbar.js
Normal file
126
js/wn/ui/toolbar/toolbar.js
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
wn.provide('wn.ui.toolbar');
|
||||
|
||||
wn.require('lib/js/wn/class.js');
|
||||
wn.require('lib/css/bootstrap/bootstrap-topbar.css');
|
||||
wn.require('lib/js/bootstrap/bootstrap-dropdown.js');
|
||||
wn.require('lib/js/wn/ui/toolbar/selector_dialog.js');
|
||||
wn.require('lib/js/wn/ui/toolbar/new.js');
|
||||
wn.require('lib/js/wn/ui/toolbar/search.js');
|
||||
wn.require('lib/js/wn/ui/toolbar/report.js');
|
||||
wn.require('lib/js/wn/ui/toolbar/recent.js');
|
||||
|
||||
wn.ui.toolbar.Toolbar = Class.extend({
|
||||
init: function() {
|
||||
this.make();
|
||||
this.make_home();
|
||||
this.make_new();
|
||||
this.make_search();
|
||||
this.make_report();
|
||||
wn.ui.toolbar.recent = new wn.ui.toolbar.RecentDocs();
|
||||
if(in_list(user_roles, 'Administrator'))
|
||||
this.make_options();
|
||||
this.make_tools();
|
||||
this.make_logout();
|
||||
|
||||
$('.topbar').dropdown();
|
||||
|
||||
$(document).trigger('toolbar_setup');
|
||||
},
|
||||
make: function() {
|
||||
$('header').append('<div class="topbar">\
|
||||
<div class="topbar-inner">\
|
||||
<div class="container">\
|
||||
<a class="brand"></a>\
|
||||
<ul class="nav">\
|
||||
</ul>\
|
||||
<img src="lib/images/ui/spinner.gif" id="spinner"/>\
|
||||
<ul class="nav secondary-nav">\
|
||||
<li class="dropdown">\
|
||||
<a class="dropdown-toggle" href="#" onclick="return false;"></a>\
|
||||
<ul class="dropdown-menu" id="toolbar-user">\
|
||||
</ul>\
|
||||
</li>\
|
||||
</ul>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>');
|
||||
},
|
||||
make_home: function() {
|
||||
$('.topbar .nav:first').append('<li><a href="#'+home_page+'">Home</a></li>')
|
||||
},
|
||||
make_new: function() {
|
||||
$('.topbar .nav:first').append('<li><a href="#" \
|
||||
onclick="return wn.ui.toolbar.new_dialog.show();">New</a></li>');
|
||||
},
|
||||
make_search: function() {
|
||||
$('.topbar .nav:first').append('<li><a href="#" \
|
||||
onclick="return wn.ui.toolbar.search.show();">Search</a></li>');
|
||||
},
|
||||
make_report: function() {
|
||||
$('.topbar .nav:first').append('<li><a href="#" \
|
||||
onclick="return wn.ui.toolbar.report.show();">Report</a></li>');
|
||||
},
|
||||
make_tools: function() {
|
||||
$('.topbar .nav:first').append('<li class="dropdown">\
|
||||
<a class="dropdown-toggle" href="#" onclick="return false;">Tools</a>\
|
||||
<ul class="dropdown-menu" id="toolbar-tools">\
|
||||
<li><a href="#" onclick="return err_console.show();">Error Console</a></li>\
|
||||
<li><a href="#" onclick="return wn.ui.toolbar.clear_cache();">Clear Cache</a></li>\
|
||||
<li><a href="#" onclick="return wn.ui.toolbar.show_about();">About</a></li>\
|
||||
</ul>\
|
||||
</li>');
|
||||
|
||||
if(has_common(user_roles,['Administrator','System Manager'])) {
|
||||
$('#toolbar-tools').append('<li><a href="#" \
|
||||
onclick="return wn.ui.toolbar.download_backup();">\
|
||||
Download Backup</a></li>');
|
||||
}
|
||||
},
|
||||
make_options: function() {
|
||||
$('.topbar .nav:first').append('<li class="dropdown">\
|
||||
<a class="dropdown-toggle" href="#" onclick="return false;">Options</a>\
|
||||
<ul class="dropdown-menu" id="toolbar-options">\
|
||||
</ul>\
|
||||
</li>');
|
||||
|
||||
profile.start_items.sort(function(a,b){return (a[4]-b[4])});
|
||||
|
||||
for(var i=0;i< profile.start_items.length;i++) {
|
||||
var d = profile.start_items[i];
|
||||
var ispage = d[0]=='Page';
|
||||
$('#toolbar-options').append(repl('<li><a href="#%(type)s%(dt)s%(dn)s">\
|
||||
%(dn)s</a></li>', {
|
||||
type : (ispage ? '' : 'Form/'),
|
||||
dt : (ispage ? '' : (d[0] + '/')),
|
||||
dn : d[5] || d[1]
|
||||
}));
|
||||
}
|
||||
},
|
||||
make_logout: function() {
|
||||
$('.topbar .nav.secondary-nav a.dropdown-toggle').html(user_fullname);
|
||||
|
||||
// logout
|
||||
$('#toolbar-user').append('<li><a href="#" onclick="return logout();">Logout</a></li>');
|
||||
}
|
||||
});
|
||||
|
||||
wn.ui.toolbar.clear_cache = function() {
|
||||
localStorage && localStorage.clear();
|
||||
$c('webnotes.session_cache.clear',{},function(r,rt){ show_alert(r.message); });
|
||||
return false;
|
||||
}
|
||||
|
||||
wn.ui.toolbar.download_backup = function() {
|
||||
$c('webnotes.utils.backups.get_backup',{},function(r,rt) {});
|
||||
return false;
|
||||
}
|
||||
|
||||
wn.ui.toolbar.show_about = function() {
|
||||
try {
|
||||
wn.require('lib/js/wn/misc/about.js');
|
||||
wn.ui.misc.about();
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue