//查看试卷模块
var paper_view = function(option, success) {
    var object = new PaperView(option);
    success();
    return object;
}

function PaperView(option) {
    this.markControl = option.markControl;
    this.server = option.server;
    this.init();
    this.markControl.on('task.get.success', this, function(event, context, eventObject) {
        this.render(this.server + context.task.paperUrl);
    });
    this.markControl.on('task.get.none', this, function(event, context, eventObject) {
        this.render();
    });
    this.markControl.on('task.get.before', this, function(event, context, eventObject) {
        this.render();
    });
}

PaperView.prototype.init = function() {
    this.markControl.initMarkFunction();
    this.toggleButton = getDom(this.toggle_button_dom, this.markControl).appendTo(this.markControl.container.assistant.functionList);
}

PaperView.prototype.render = function(url) {
    if (url != undefined && url.length > 0) {
        this.toggleButton.attr('href', url);
        this.toggleButton.show();
    } else {
        this.toggleButton.attr('href', '##');
        this.toggleButton.hide();
    }
}

PaperView.prototype.toggle_button_dom = '<a href="#" target="_blank">试卷</a>';