##// END OF EJS Templates
add dialog when loading newer minor-version notebooks
MinRK -
Show More
@@ -32,6 +32,7 b' var IPython = (function (IPython) {'
32 this.notebook_name = null;
32 this.notebook_name = null;
33 this.notebook_name_blacklist_re = /[\/\\:]/;
33 this.notebook_name_blacklist_re = /[\/\\:]/;
34 this.nbformat = 3 // Increment this when changing the nbformat
34 this.nbformat = 3 // Increment this when changing the nbformat
35 this.nbformat_minor = 0 // Increment this when changing the nbformat
35 this.style();
36 this.style();
36 this.create_elements();
37 this.create_elements();
37 this.bind_events();
38 this.bind_events();
@@ -1050,6 +1051,7 b' var IPython = (function (IPython) {'
1050 var data = this.toJSON();
1051 var data = this.toJSON();
1051 data.metadata.name = this.notebook_name;
1052 data.metadata.name = this.notebook_name;
1052 data.nbformat = this.nbformat;
1053 data.nbformat = this.nbformat;
1054 data.nbformat_minor = this.nbformat_minor;
1053 // We do the call with settings so we can set cache to false.
1055 // We do the call with settings so we can set cache to false.
1054 var settings = {
1056 var settings = {
1055 processData : false,
1057 processData : false,
@@ -1126,6 +1128,31 b' var IPython = (function (IPython) {'
1126 },
1128 },
1127 width: 400
1129 width: 400
1128 });
1130 });
1131 } else if (data.orig_nbformat_minor !== undefined && data.nbformat_minor !== data.orig_nbformat_minor) {
1132 var that = this;
1133 var orig_vs = 'v' + data.nbformat + '.' + data.orig_nbformat_minor;
1134 var this_vs = 'v' + data.nbformat + '.' + this.nbformat_minor;
1135 msg = "This notebook is version " + orig_vs + ", but we only fully support up to " +
1136 this_vs + ". You can still work with this notebook, but some features " +
1137 "introduced in later notebook versions may not be available."
1138
1139 var dialog = $('<div/>');
1140 dialog.html(msg);
1141 this.element.append(dialog);
1142 dialog.dialog({
1143 resizable: false,
1144 modal: true,
1145 title: "Newer Notebook",
1146 closeText: "",
1147 close: function(event, ui) {$(this).dialog('destroy').remove();},
1148 buttons : {
1149 "OK": function () {
1150 $(this).dialog('close');
1151 }
1152 },
1153 width: 400
1154 });
1155
1129 }
1156 }
1130 // Create the kernel after the notebook is completely loaded to prevent
1157 // Create the kernel after the notebook is completely loaded to prevent
1131 // code execution upon loading, which is a security risk.
1158 // code execution upon loading, which is a security risk.
General Comments 0
You need to be logged in to leave comments. Login now