//查看原始题卡模块
var sheet_view = function(option, success) {
    var object = new SheetView(option);
    success();
    return object;
}

function SheetView(option) {
    this.markControl = option.markControl;
    this.server = option.server;
    this.init();
    this.markControl.on('task.get.success', this, function(event, context, eventObject) {
        this.render(context.task.sheetUrls);
    });
    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();
    });
}

SheetView.prototype.init = function() {
    this.markControl.initMarkFunction();
    this.container = getDom(this.container_dom, this.markControl).appendTo(this.markControl.container.assistant).find('#sheet-list');
}

SheetView.prototype.render = function(urls) {
    if (urls != undefined && urls.length > 0) {
        this.container.empty();
        for (var i = 0; i < urls.length; i++) {
            this.container.append('<a href="' + (this.server + urls[i]) + '" target="_blank">' + (i + 1) + '</a>');
        }
        this.container.show();
    } else {
        this.container.hide();
    }
}

SheetView.prototype.container_dom = '<h3 class="popover-title">查看原卷</h3>\
<div class="popover-content"><p id="sheet-list" class="popover-list">\
</p></div>';