From 6b95c7ed6f3cf2a33b80ac4c7160f6e3c3a85646 Mon Sep 17 00:00:00 2001 From: halcyon <864072399@qq.com> Date: Wed, 14 Jan 2015 16:39:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E4=BA=A7=E8=AF=A6=E6=83=85=E5=BC=B9?= =?UTF-8?q?=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jasset/urls.py | 13 +- jasset/views.py | 11 +- static/css/colorbox.css | 50 ++ static/css/images/controls.png | Bin 0 -> 503 bytes static/css/images/loading.gif | Bin 0 -> 6244 bytes static/js/jquery.colorbox.js | 1090 ++++++++++++++++++++++++++++++++ templates/base.html | 3 +- templates/css_js.html | 33 + templates/jasset/jadd.html | 14 +- templates/jasset/jlist.html | 10 +- templates/jasset/jlist_ip.html | 60 ++ templates/link_css.html | 1 + templates/script.html | 3 + 13 files changed, 1270 insertions(+), 18 deletions(-) create mode 100755 static/css/colorbox.css create mode 100755 static/css/images/controls.png create mode 100755 static/css/images/loading.gif create mode 100755 static/js/jquery.colorbox.js create mode 100644 templates/css_js.html create mode 100644 templates/jasset/jlist_ip.html diff --git a/jasset/urls.py b/jasset/urls.py index 463d696bc..e60b47f71 100644 --- a/jasset/urls.py +++ b/jasset/urls.py @@ -4,10 +4,11 @@ from jasset.views import * urlpatterns = patterns('', url(r'^$', index), - url(r'host_add', jadd_host), - url(r'host_list', jlist_host), - url(r'idc_add', jadd_idc), - url(r'idc_list', jlist_idc), - url(r'group_add', jadd_group), - url(r'group_list', jlist_group), + url(r'host_add/$', jadd_host), + url(r'host_list/$', jlist_host), + url(r"(\d+.\d+.\d+.\d+)/$",jlist_ip), + url(r'idc_add/$', jadd_idc), + url(r'idc_list/$', jlist_idc), + url(r'group_add/$', jadd_group), + url(r'group_list/$', jlist_group), ) \ No newline at end of file diff --git a/jasset/views.py b/jasset/views.py index cfcb1818b..7419519a8 100644 --- a/jasset/views.py +++ b/jasset/views.py @@ -1,10 +1,6 @@ # coding:utf-8 -import datetime -from django.shortcuts import render -from django.http import HttpResponse from django.template import RequestContext from django.shortcuts import render_to_response -from django.http import HttpResponseRedirect from django.core.paginator import Paginator, EmptyPage from models import IDC, Asset, BisGroup @@ -73,7 +69,7 @@ def jlist_host(request): header_title, path1, path2 = '查看主机 | List Host', '资产管理', '查看主机' posts = contact_list = Asset.objects.all().order_by('ip') print posts - paginator = Paginator(contact_list, 5) + p = paginator = Paginator(contact_list, 5) try: page = int(request.GET.get('page', '1')) except ValueError: @@ -86,6 +82,11 @@ def jlist_host(request): return render_to_response('jasset/jlist.html', locals(), context_instance=RequestContext(request)) +def jlist_ip(request, offset): + header_title, path1, path2 = '主机详细信息 | Host Detail.', '资产管理', '主机详情' + print offset + post = contact_list = Asset.objects.get(ip = str(offset)) + return render_to_response('jasset/jlist_ip.html', locals(), context_instance=RequestContext(request)) def jadd_idc(request): header_title, path1, path2 = '添加IDC | Add IDC', '资产管理', '添加IDC' diff --git a/static/css/colorbox.css b/static/css/colorbox.css new file mode 100755 index 000000000..0a6710404 --- /dev/null +++ b/static/css/colorbox.css @@ -0,0 +1,50 @@ +/* + Colorbox Core Style: + The following CSS is consistent between example themes and should not be altered. +*/ +#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} +#cboxWrapper {max-width:none;} +#cboxOverlay{position:fixed; width:100%; height:100%;} +#cboxMiddleLeft, #cboxBottomLeft{clear:left;} +#cboxContent{position:relative;} +#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;} +#cboxTitle{margin:0;} +#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} +#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} +.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;} +.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;} +#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} + +/* + User Style: + Change the following styles to modify the appearance of Colorbox. They are + ordered & tabbed in a way that represents the nesting of the generated HTML. +*/ +#cboxOverlay{background:#fff; opacity: 0.9; filter: alpha(opacity = 90);} +#colorbox{outline:0;} + #cboxContent{margin-top:32px; overflow:visible; background:#000;} + .cboxIframe{background:#fff;} + #cboxError{padding:50px; border:1px solid #ccc;} + #cboxLoadedContent{background:#000; padding:1px;} + #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;} + #cboxLoadingOverlay{background:#000;} + #cboxTitle{position:absolute; top:-22px; left:0; color:#000;} + #cboxCurrent{position:absolute; top:-22px; right:205px; text-indent:-9999px;} + + /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ + #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; text-indent:-9999px; width:20px; height:20px; position:absolute; top:-20px; background:url(images/controls.png) no-repeat 0 0;} + + /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ + #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} + + #cboxPrevious{background-position:0px 0px; right:44px;} + #cboxPrevious:hover{background-position:0px -25px;} + #cboxNext{background-position:-25px 0px; right:22px;} + #cboxNext:hover{background-position:-25px -25px;} + #cboxClose{background-position:-50px 0px; right:0;} + #cboxClose:hover{background-position:-50px -25px;} + .cboxSlideshow_on #cboxPrevious, .cboxSlideshow_off #cboxPrevious{right:66px;} + .cboxSlideshow_on #cboxSlideshow{background-position:-75px -25px; right:44px;} + .cboxSlideshow_on #cboxSlideshow:hover{background-position:-100px -25px;} + .cboxSlideshow_off #cboxSlideshow{background-position:-100px 0px; right:44px;} + .cboxSlideshow_off #cboxSlideshow:hover{background-position:-75px -25px;} diff --git a/static/css/images/controls.png b/static/css/images/controls.png new file mode 100755 index 0000000000000000000000000000000000000000..36f5269929f735d3d3d14424f03fd7f3010045c7 GIT binary patch literal 503 zcmVQvGG};B5A2d>; z`je}=1^Jhm`qW>d=5@(X;wfqp5zC7xY5KLHsKHI)ugz!V^z|WQ5G@grgb<^mpB`H} zW~d_aZoY|?qhnAH9ubM?Q+{M8B1Eja$*vFiawj$>< zcl;^3jy`qk{QLUWuSQZQ=j@%)I5_6g@dSx z);f7w8#O&GAZlPy__Uae1XCY6Ako4ARxAK3dN9z^Aww0Bck@k7Ia&vGG5}z${g5Ad z{MiD4x|{48%9o(%@R3Gz2PL<@OID4C8ZWh$*srh9)Zg$ybRA6W*4^*xOTRAkPN%^q zZ-Ek=bK*L>?9gA*5*_QWl5aNqSGE@Kn002ovPDHLkV1k`%>Zt$# literal 0 HcmV?d00001 diff --git a/static/css/images/loading.gif b/static/css/images/loading.gif new file mode 100755 index 0000000000000000000000000000000000000000..a32df5c0881b563e18f3660758009a4aec47a5a0 GIT binary patch literal 6244 zcmZu#d010-y8dMkfrNxW2!|wugzaR5ummJ52>}uU1cX4?466u;EaFmUdgsA&63D`m zfXJdEB6X`;(Q4Ie9j$wB+fmyhZS9P;w%5_=OzX5Www-x;57@=dbMx=XAMgAA-tYU~ z@6+eyrmUzJ0wMT^7R=AjCnY6mG#VO>78e&6930H$avK{PGcq!CI$cFYMOj%{dwaW5 zsiaUSJv}`Ng<|8zjZ;%oVzKzmH{YC@nF$XMKX~vUlgXT%oW$X9R;#tHt}Ze%l0YD& zrltl31>LxDBRV>o#bODCLZ{O?K0bcv(4pV`?souy{{DVHKR+s!N+OZ!>+4^7>7{qx zd8ebJqot)~&6+jS)6+Y5?qo0+1qB6r_Ut))_;5~6j$W^CYilbmE*=^hTD^L8O-+r- zWJ*g*GZ+k2RaLLO_S(voD|tMg#bSBut+xaMfzfD;iHSLR@?>dg>E6A2j~zR9>(;H! zn>X*@zh5SkX|-CH%LPG@-EL1#PJZ{@cYpJn-y|d?c)eaWn|<`?(XCsz4h#&Wq@;|E zja|BQ>B^NW5{c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QK-13dG96~b)* literal 0 HcmV?d00001 diff --git a/static/js/jquery.colorbox.js b/static/js/jquery.colorbox.js new file mode 100755 index 000000000..c0348849e --- /dev/null +++ b/static/js/jquery.colorbox.js @@ -0,0 +1,1090 @@ +/*! + Colorbox 1.5.14 + license: MIT + http://www.jacklmoore.com/colorbox +*/ +(function ($, document, window) { + var + // Default settings object. + // See http://jacklmoore.com/colorbox for details. + defaults = { + // data sources + html: false, + photo: false, + iframe: false, + inline: false, + + // behavior and appearance + transition: "elastic", + speed: 300, + fadeOut: 300, + width: false, + initialWidth: "600", + innerWidth: false, + maxWidth: false, + height: false, + initialHeight: "450", + innerHeight: false, + maxHeight: false, + scalePhotos: true, + scrolling: true, + opacity: 0.9, + preloading: true, + className: false, + overlayClose: true, + escKey: true, + arrowKey: true, + top: false, + bottom: false, + left: false, + right: false, + fixed: false, + data: undefined, + closeButton: true, + fastIframe: true, + open: false, + reposition: true, + loop: true, + slideshow: false, + slideshowAuto: true, + slideshowSpeed: 2500, + slideshowStart: "start slideshow", + slideshowStop: "stop slideshow", + photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i, + + // alternate image paths for high-res displays + retinaImage: false, + retinaUrl: false, + retinaSuffix: '@2x.$1', + + // internationalization + current: "image {current} of {total}", + previous: "previous", + next: "next", + close: "close", + xhrError: "This content failed to load.", + imgError: "This image failed to load.", + + // accessbility + returnFocus: true, + trapFocus: true, + + // callbacks + onOpen: false, + onLoad: false, + onComplete: false, + onCleanup: false, + onClosed: false, + + rel: function() { + return this.rel; + }, + href: function() { + // using this.href would give the absolute url, when the href may have been inteded as a selector (e.g. '#container') + return $(this).attr('href'); + }, + title: function() { + return this.title; + } + }, + + // Abstracting the HTML and event identifiers for easy rebranding + colorbox = 'colorbox', + prefix = 'cbox', + boxElement = prefix + 'Element', + + // Events + event_open = prefix + '_open', + event_load = prefix + '_load', + event_complete = prefix + '_complete', + event_cleanup = prefix + '_cleanup', + event_closed = prefix + '_closed', + event_purge = prefix + '_purge', + + // Cached jQuery Object Variables + $overlay, + $box, + $wrap, + $content, + $topBorder, + $leftBorder, + $rightBorder, + $bottomBorder, + $related, + $window, + $loaded, + $loadingBay, + $loadingOverlay, + $title, + $current, + $slideshow, + $next, + $prev, + $close, + $groupControls, + $events = $(''), // $({}) would be prefered, but there is an issue with jQuery 1.4.2 + + // Variables for cached values or use across multiple functions + settings, + interfaceHeight, + interfaceWidth, + loadedHeight, + loadedWidth, + index, + photo, + open, + active, + closing, + loadingTimer, + publicMethod, + div = "div", + requests = 0, + previousCSS = {}, + init; + + // **************** + // HELPER FUNCTIONS + // **************** + + // Convenience function for creating new jQuery objects + function $tag(tag, id, css) { + var element = document.createElement(tag); + + if (id) { + element.id = prefix + id; + } + + if (css) { + element.style.cssText = css; + } + + return $(element); + } + + // Get the window height using innerHeight when available to avoid an issue with iOS + // http://bugs.jquery.com/ticket/6724 + function winheight() { + return window.innerHeight ? window.innerHeight : $(window).height(); + } + + function Settings(element, options) { + if (options !== Object(options)) { + options = {}; + } + + this.cache = {}; + this.el = element; + + this.value = function(key) { + var dataAttr; + + if (this.cache[key] === undefined) { + dataAttr = $(this.el).attr('data-cbox-'+key); + + if (dataAttr !== undefined) { + this.cache[key] = dataAttr; + } else if (options[key] !== undefined) { + this.cache[key] = options[key]; + } else if (defaults[key] !== undefined) { + this.cache[key] = defaults[key]; + } + } + + return this.cache[key]; + }; + + this.get = function(key) { + var value = this.value(key); + return $.isFunction(value) ? value.call(this.el, this) : value; + }; + } + + // Determine the next and previous members in a group. + function getIndex(increment) { + var + max = $related.length, + newIndex = (index + increment) % max; + + return (newIndex < 0) ? max + newIndex : newIndex; + } + + // Convert '%' and 'px' values to integers + function setSize(size, dimension) { + return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10)); + } + + // Checks an href to see if it is a photo. + // There is a force photo option (photo: true) for hrefs that cannot be matched by the regex. + function isImage(settings, url) { + return settings.get('photo') || settings.get('photoRegex').test(url); + } + + function retinaUrl(settings, url) { + return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url; + } + + function trapFocus(e) { + if ('contains' in $box[0] && !$box[0].contains(e.target) && e.target !== $overlay[0]) { + e.stopPropagation(); + $box.focus(); + } + } + + function setClass(str) { + if (setClass.str !== str) { + $box.add($overlay).removeClass(setClass.str).addClass(str); + setClass.str = str; + } + } + + function getRelated(rel) { + index = 0; + + if (rel && rel !== false && rel !== 'nofollow') { + $related = $('.' + boxElement).filter(function () { + var options = $.data(this, colorbox); + var settings = new Settings(this, options); + return (settings.get('rel') === rel); + }); + index = $related.index(settings.el); + + // Check direct calls to Colorbox. + if (index === -1) { + $related = $related.add(settings.el); + index = $related.length - 1; + } + } else { + $related = $(settings.el); + } + } + + function trigger(event) { + // for external use + $(document).trigger(event); + // for internal use + $events.triggerHandler(event); + } + + var slideshow = (function(){ + var active, + className = prefix + "Slideshow_", + click = "click." + prefix, + timeOut; + + function clear () { + clearTimeout(timeOut); + } + + function set() { + if (settings.get('loop') || $related[index + 1]) { + clear(); + timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed')); + } + } + + function start() { + $slideshow + .html(settings.get('slideshowStop')) + .unbind(click) + .one(click, stop); + + $events + .bind(event_complete, set) + .bind(event_load, clear); + + $box.removeClass(className + "off").addClass(className + "on"); + } + + function stop() { + clear(); + + $events + .unbind(event_complete, set) + .unbind(event_load, clear); + + $slideshow + .html(settings.get('slideshowStart')) + .unbind(click) + .one(click, function () { + publicMethod.next(); + start(); + }); + + $box.removeClass(className + "on").addClass(className + "off"); + } + + function reset() { + active = false; + $slideshow.hide(); + clear(); + $events + .unbind(event_complete, set) + .unbind(event_load, clear); + $box.removeClass(className + "off " + className + "on"); + } + + return function(){ + if (active) { + if (!settings.get('slideshow')) { + $events.unbind(event_cleanup, reset); + reset(); + } + } else { + if (settings.get('slideshow') && $related[1]) { + active = true; + $events.one(event_cleanup, reset); + if (settings.get('slideshowAuto')) { + start(); + } else { + stop(); + } + $slideshow.show(); + } + } + }; + + }()); + + + function launch(element) { + var options; + + if (!closing) { + + options = $(element).data(colorbox); + + settings = new Settings(element, options); + + getRelated(settings.get('rel')); + + if (!open) { + open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys. + + setClass(settings.get('className')); + + // Show colorbox so the sizes can be calculated in older versions of jQuery + $box.css({visibility:'hidden', display:'block', opacity:''}); + + $loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden'); + $content.css({width:'', height:''}).append($loaded); + + // Cache values needed for size calculations + interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height(); + interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width(); + loadedHeight = $loaded.outerHeight(true); + loadedWidth = $loaded.outerWidth(true); + + // Opens inital empty Colorbox prior to content being loaded. + var initialWidth = setSize(settings.get('initialWidth'), 'x'); + var initialHeight = setSize(settings.get('initialHeight'), 'y'); + var maxWidth = settings.get('maxWidth'); + var maxHeight = settings.get('maxHeight'); + + settings.w = (maxWidth !== false ? Math.min(initialWidth, setSize(maxWidth, 'x')) : initialWidth) - loadedWidth - interfaceWidth; + settings.h = (maxHeight !== false ? Math.min(initialHeight, setSize(maxHeight, 'y')) : initialHeight) - loadedHeight - interfaceHeight; + + $loaded.css({width:'', height:settings.h}); + publicMethod.position(); + + trigger(event_open); + settings.get('onOpen'); + + $groupControls.add($title).hide(); + + $box.focus(); + + if (settings.get('trapFocus')) { + // Confine focus to the modal + // Uses event capturing that is not supported in IE8- + if (document.addEventListener) { + + document.addEventListener('focus', trapFocus, true); + + $events.one(event_closed, function () { + document.removeEventListener('focus', trapFocus, true); + }); + } + } + + // Return focus on closing + if (settings.get('returnFocus')) { + $events.one(event_closed, function () { + $(settings.el).focus(); + }); + } + } + + var opacity = parseFloat(settings.get('opacity')); + $overlay.css({ + opacity: opacity === opacity ? opacity : '', + cursor: settings.get('overlayClose') ? 'pointer' : '', + visibility: 'visible' + }).show(); + + if (settings.get('closeButton')) { + $close.html(settings.get('close')).appendTo($content); + } else { + $close.appendTo('
'); // replace with .detach() when dropping jQuery < 1.4 + } + + load(); + } + } + + // Colorbox's markup needs to be added to the DOM prior to being called + // so that the browser will go ahead and load the CSS background images. + function appendHTML() { + if (!$box) { + init = false; + $window = $(window); + $box = $tag(div).attr({ + id: colorbox, + 'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS. + role: 'dialog', + tabindex: '-1' + }).hide(); + $overlay = $tag(div, "Overlay").hide(); + $loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]); + $wrap = $tag(div, "Wrapper"); + $content = $tag(div, "Content").append( + $title = $tag(div, "Title"), + $current = $tag(div, "Current"), + $prev = $('
- {% include 'script.html' %} + diff --git a/templates/css_js.html b/templates/css_js.html new file mode 100644 index 000000000..9004ffc1e --- /dev/null +++ b/templates/css_js.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/jasset/jadd.html b/templates/jasset/jadd.html index bae139d69..fe5ecd0de 100644 --- a/templates/jasset/jadd.html +++ b/templates/jasset/jadd.html @@ -7,9 +7,9 @@ +
+ addidc +
-
+
{% if emg %}
{{ emg }}
{% endif %} @@ -146,6 +149,9 @@ var showFlag={}; if(showFlag.j_type=="MAP"){ document.getElementById("a1").style.display=""; } + else if(showFlag.addidc=="addidc"){ + document.getElementById("addidc").style.display=""; + } else{ document.getElementById("a1").style.display="none"; }}; diff --git a/templates/jasset/jlist.html b/templates/jasset/jlist.html index 5d1c3ed75..7798b3a2a 100644 --- a/templates/jasset/jlist.html +++ b/templates/jasset/jlist.html @@ -47,9 +47,9 @@ {% for post in contacts.object_list %} - {{ post.ip }} + {{ post.ip }} {{ post.port }} - {{ post.login_type}} + {{ post.get_login_type}} {{ post.idc.name }} {% for group in post.bis_group.all %} @@ -85,4 +85,10 @@
+ + {% endblock %} \ No newline at end of file diff --git a/templates/jasset/jlist_ip.html b/templates/jasset/jlist_ip.html new file mode 100644 index 000000000..11f975edb --- /dev/null +++ b/templates/jasset/jlist_ip.html @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + +
+
+

{{ offset }}主机详情

+ + + + + + + + + + + + + + + + + + + + + + + +
IP地址 端口号 登录方式 所属IDC 所属业务组 添加时间 备注
{{ post.ip }} {{ post.port }} {{ post.get_login_type}} {{ post.idc.name }} + {% for group in post.bis_group.all %} + {{ group }} + {% endfor %} + {{ post.date_added }} {{ post.comment }}
+ 是否激活: {{ post.is_active }} +
+
+ + \ No newline at end of file diff --git a/templates/link_css.html b/templates/link_css.html index 26fd0e087..2d795dece 100644 --- a/templates/link_css.html +++ b/templates/link_css.html @@ -3,3 +3,4 @@ + \ No newline at end of file diff --git a/templates/script.html b/templates/script.html index da70b090e..7d22a71b4 100644 --- a/templates/script.html +++ b/templates/script.html @@ -26,3 +26,6 @@ + + +