Skip to content

Commit

Permalink
Merged in working feature for new importer
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Whitacre committed Mar 14, 2014
2 parents eaf6453 + fa0a223 commit bd98e43
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class JSONImportStateMarks implements JSONImportStateInterface
* @var boolean
*/
const RETURN_DETAILS_ERRORS_ONLY = true;

/*
* Result keys
*/
Expand All @@ -37,13 +37,13 @@ class JSONImportStateMarks implements JSONImportStateInterface
* @var string
*/
const RESULT_ADDED = 'added';

/**
* Number of marks already existing in the system
* @var string
*/
const RESULT_SKIPPED = 'skipped';

/**
* Number of marks not imported due to errors
* @var string
Expand All @@ -59,7 +59,7 @@ class JSONImportStateMarks implements JSONImportStateInterface

/**
* Cache for 'unlabeled' label id used to mark entries with unknown label
*
*
* @var int
*/
private $unlabeled_label_id = null;
Expand Down Expand Up @@ -91,7 +91,7 @@ public function processLine($line)
// Strip trailing comma and simulate JSON
$jsonLine = mb_ereg_replace("\\,[ ]*$", '', $line);
$decodedMark = json_decode($jsonLine);
$importResult = $this->CI->mark_import->importMark($decodedMark);
$importResult = $this->CI->Mark_Import->importMark($decodedMark);
$this->importData['result']['total'] ++;
$this->importData['result'][$importResult['result']] ++;
if (self::RETURN_DETAILS && (! self::RETURN_DETAILS_ERRORS_ONLY || $importResult['result'] === self::RESULT_FAILED || ! empty($importResult['warnings']))) {
Expand All @@ -101,4 +101,4 @@ public function processLine($line)
}
}

}
}
2 changes: 1 addition & 1 deletion assets/css/unmark.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/unmark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1648,7 +1648,7 @@ body.label-7 .navigation-pane { border-top: none; }
display: block;
margin-bottom: 36px;
}
.importer {
.importer, .importerHTML {
display:none;
}
small {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/production/unmark.bookmarklet.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/production/unmark.loggedin.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions assets/js/unmark.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@
unmark.import_data = function () {
return $('.importer').trigger('click');
};
unmark.import_data_html = function () {
return $('.importerHTML').trigger('click');
};


}(window.jQuery));
3 changes: 3 additions & 0 deletions assets/js/unmark.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
$('.importer').change(function (e) {
return $('#importForm').submit();
});
$('.importerHTML').change(function (e) {
return $('#importFormHTML').submit();
});

};

Expand Down

0 comments on commit bd98e43

Please sign in to comment.