1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- //回评模块
- var view_sidebar = function(option, success) {
- var object = new ViewSidebar(option);
- success();
- return object;
- }
- function ViewSidebar(option) {
- this.markControl = option.markControl;
- this.list = option.list;
- this.init();
- }
- ViewSidebar.prototype.init = function() {
- var self = this;
- this.container = getDom(this.container_dom, this.markControl).prependTo(this.markControl.container);
- this.container.list = this.container.find('#view-list');
- this.container.content = this.container.find('#view-content');
- if (this.list.length > 0) {
- for (var i = 0; i < this.list.length; i++) {
- var option = this.list[i];
- if (option.url == undefined || option.url.length == 0) {
- continue;
- }
- this.container.list.append('<i style="cursor:pointer" data-url="' + option.url + '">' + option.title + '</i>');
- this.container.list.append(' ')
- }
- this.container.list.find('i').click(function() {
- self.container.list.find('i').removeClass('yellow');
- $(this).addClass('yellow');
- self.changeContent($(this).attr('data-url'));
- });
- this.container.list.find('i:first').trigger('click');
- this.markControl.initMarkFunction();
- this.toggleButton = getDom(this.toggle_button_dom, this.markControl).appendTo(this.markControl.container.assistant.functionList);
- this.toggleButton.click(this, function(event) {
- self.toggle(true);
- });
- }
- this.container.find('#view-close-button').click(this, function(event) {
- self.toggle(false);
- });
- }
- ViewSidebar.prototype.toggle = function(enable) {
- if (enable) {
- this.markControl.trigger('view.sidebar.open');
- this.container.removeClass('hide');
- } else {
- this.container.addClass('hide');
- this.markControl.trigger('view.sidebar.close');
- }
- }
- ViewSidebar.prototype.changeContent = function(url) {
- this.container.content.empty();
- var dom = $(this.content_dom);
- dom[0].width = this.container.width();
- dom[0].height = this.container.height() * 0.9;
- dom.find('object')[0].width = this.container.width();
- dom.find('object')[0].height = this.container.height() * 0.9;
- dom.find('#object-src').val(url);
- dom.find('object')[0].data = url;
- this.container.content.append(dom);
- }
- ViewSidebar.prototype.toggle_button_dom = '<a href="#">侧边栏</a>';
- ViewSidebar.prototype.container_dom = '<div class="mark-sidebar span5 hide">\
- <div class="header"><p class="fl" id="view-list"></p>\
- <a href="##" id="view-close-button"><img src="{staticServer}/mark-new/images/hp-close.png"></a>\
- </div>\
- <div id="view-content"></div>\
- </div>';
- ViewSidebar.prototype.content_dom = '<object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="" height="" border="0">\
- <param name="_Version" value="65539">\
- <param name="_ExtentX" value="20108">\
- <param name="_ExtentY" value="10866">\
- <param name="_StockProps" value="0">\
- <param name="SRC" id="object-src" value="">\
- <object data="" type="application/pdf" width="" height=""></object>\
- </object>';
|