--- a/hdalab/css/style.css Mon Jan 30 18:20:59 2012 +0100
+++ b/hdalab/css/style.css Thu Feb 02 12:03:07 2012 +0100
@@ -19,7 +19,7 @@
font-size: 10px;
}
-input {
+input, textarea {
font-family: "Open Sans", Arial, Helvetica, sans-serif;
}
@@ -96,8 +96,12 @@
color: #990000;
}
-#partageurls {
- float: right; text-align: center; clear: both; list-style: none; padding: 0; margin: 2px 0;
+#nouvellevue a {
+ font-weight: bold; color: #ff3000; font-size: 16px;
+}
+
+#partageurls, #plusdevues {
+ float: right; text-align: right; clear: both; list-style: none; padding: 0; margin: 2px 0;
font-size: 13px; display: none;
}
@@ -269,7 +273,7 @@
}
.content-annotation ul {
- list-style : disc; margin: 2px 0; padding: 0 0 0 16px; font-size: 12px;
+ list-style : disc; margin: 2px 0; padding-left: 1.5em; font-size: 12px;
cursor: pointer; cursor: hand;
}
@@ -278,7 +282,7 @@
}
.content-annotation textarea {
- width: 99%; font-family: Arial, Helvetica, sans-serif; margin: 0; padding: 0; font-size: 12px;
+ width: 99%; margin: 0; padding: 0; font-size: 12px;
}
ul.content-tags {
@@ -352,3 +356,11 @@
#widgetlist label {
font-size: 13px;
}
+
+#notes ul {
+ font-size: 13px; margin: 0; padding-left: 1.5em;
+}
+
+#notes textarea {
+ padding: 0; margin: 0; width: 99%; font-size: 13px;
+}
--- a/hdalab/index.html Mon Jan 30 18:20:59 2012 +0100
+++ b/hdalab/index.html Thu Feb 02 12:03:07 2012 +0100
@@ -28,7 +28,12 @@
<h4 id="vuestitre">Mes vues :</h4>
<ul id="ongletsvues">
</ul>
+ <span id="nouvellevue"><a href="#">+</a></span>
</div>
+ <ul id="plusdevues">
+ <li id="nouv_resrech"><a href="#">Créer une vue sur des résultats de recherche</a></li>
+ <li id="nouv_liste"><a href="#">Créer une liste de notices</a></li>
+ </ul>
<div id="bandefiltre">
<h4 id="filtertitle">
Filtres :
@@ -84,6 +89,12 @@
</div>
</div>
<div id="rightcol">
+ <div class="bloc" id="bloc_notes">
+ <div class="barrebloc">
+ <h2>Notes</h2>
+ </div>
+ <div id="notes" class="corpsbloc"></div>
+ </div>
<div class="bloc" id="bloc_disciplines">
<div class="barrebloc">
<h2>Disciplines artistiques</h2>
--- a/hdalab/js/gomina.js Mon Jan 30 18:20:59 2012 +0100
+++ b/hdalab/js/gomina.js Thu Feb 02 12:03:07 2012 +0100
@@ -201,9 +201,13 @@
}).join('')
+ '</ul><h4>Annotations</h4><div class="content-annotation" contentid="'
+ _d.id
- + '"><ul><li>'
- + (gomNs.sessiondata.annotations[_d.id] && gomNs.sessiondata.annotations[_d.id].texte ? gomNs.sessiondata.annotations[_d.id].texte.replace(/\n/gm,"</p><p>") : 'Annoter ce contenu...')
- + '</li></ul></div>';
+ + '">'
+ + ( gomNs.sessiondata.annotations[_d.id] && gomNs.sessiondata.annotations[_d.id].texte
+ ? '<ul><li>'
+ + _.escape(gomNs.sessiondata.annotations[_d.id].texte).replace(/\n/gm,"</li><li>")
+ + '</li>'
+ : ( gomNs.write_allowed ? '<ul><li>Annoter ce contenu...</li></ul>' : '' ) )
+ + '</div>';
if (gomNs.write_allowed) {
_(gomNs.sessiondata.views).each(function(_view, _k) {
if (_view.type == 'list') {
@@ -253,8 +257,8 @@
if (!gomNs.sessiondata.annotations[_id]) {
gomNs.sessiondata.annotations[_id] = {};
}
- gomNs.sessiondata.annotations[_id].texte = _.escape(this.value);
- this.parentNode.innerHTML = '<ul><li>' + (this.value.length ? gomNs.sessiondata.annotations[_id].texte.replace(/\n/gm,"</li><li>") : 'Annoter ce contenu...' ) + '</ul>';
+ gomNs.sessiondata.annotations[_id].texte = this.value;
+ this.parentNode.innerHTML = '<ul><li>' + (this.value.length ? _.escape(gomNs.sessiondata.annotations[_id].texte).replace(/\n/gm,"</li><li>") : 'Annoter ce contenu...' ) + '</ul>';
debouncedSaveChanges();
});
$(this).html(_el);
@@ -417,7 +421,10 @@
_(_curView.hiddenWidgets).each(function(_w) {
$("#chbx_" + _w).prop("checked",false);
$("#" + _w).hide();
- })
+ });
+ $("#notes").html( _curView.notes
+ ? '<ul><li>' + _.escape(_curView.notes).replace(/\n/gm,"</li><li>") + '</li></ul>'
+ : ( gomNs.write_allowed ? '<ul><li>Annoter cette vue...</li></ul>' : '' ) );
switch(_curView.type) {
case 'list':
$("#bandefiltre, .handle").hide();
@@ -432,6 +439,18 @@
}
}
+function displayViewList() {
+ $("#ongletsvues").html(gomNs.sessiondata.views.map(function(_v, _k) {
+ return '<li class="lienvue" id="view_'
+ + _k
+ + '" onclick="changeView('
+ + _k
+ + '); return false;"><a href="#">'
+ + _.escape(_v.name)
+ + '</a></li>';
+ }).join(""))
+}
+
function getInitialView() {
var _urlParam = {};
if (document.location.hash) {
@@ -461,39 +480,16 @@
if (!gomNs.sessiondata.title) {
gomNs.sessiondata.title = 'Nouvelle session';
}
- if (!gomNs.sessiondata.view) {
- gomNs.sessiondata.view = 0;
- }
if (!gomNs.sessiondata.views) {
gomNs.sessiondata.views = [];
}
if (!gomNs.sessiondata.views.length) {
- gomNs.sessiondata.views[0] = {
- type: 'filter',
- name: 'Mes résultats de recherche',
- period: [ gomNs.minYear, gomNs.maxYear ],
- tag: [],
- hiddenWidgets: [],
- };
- gomNs.sessiondata.views[1] = {
- type: 'list',
- name: 'Ma liste',
- list: [],
- hiddenWidgets: [],
- };
+ addView( 'filter', 'Mes résultats de recherche' );
+ addView( 'list', 'Ma liste' );
}
if (!gomNs.sessiondata.annotations) {
gomNs.sessiondata.annotations = {};
}
- $("#ongletsvues").html(gomNs.sessiondata.views.map(function(_v, _k) {
- return '<li class="lienvue" id="view_'
- + _k
- + '" onclick="changeView('
- + _k
- + '); return false;"><a href="#">'
- + _.escape(_v.name)
- + '</a></li>';
- }).join(""))
if (data.write_allowed) {
$("#bloc_gestvue").show();
} else {
@@ -503,11 +499,11 @@
+ ( data.write_allowed ? '' : '<span class="lectseul"> (lecture seule)</span>' ) );
gomNs.hrefinterval = setInterval(function() {
if (document.location.hash != gomNs.hash) {
- console.log("Changement de hash");
clearInterval(gomNs.hrefinterval);
getInitialView();
}
}, 500);
+ displayViewList();
showView();
});
}
@@ -518,6 +514,25 @@
debouncedSaveChanges();
}
+function addView(viewtype, viewname) {
+ var _content = {
+ type: viewtype,
+ name: viewname,
+ hiddenWidgets: [],
+ };
+ switch(viewtype) {
+ case 'filter':
+ _content.period = [ gomNs.minYear, gomNs.maxYear ];
+ _content.tag = [];
+ gomNs.sessiondata.view = gomNs.sessiondata.views.length;
+ break;
+ case 'list':
+ _content.list = [];
+ break;
+ }
+ gomNs.sessiondata.views.push(_content);
+ debouncedSaveChanges();
+}
$(document).ready(function() {
gomNs.map = new google.maps.Map(document.getElementById("map"),
@@ -600,6 +615,23 @@
$("#view_" + gomNs.sessiondata.view + " a").html(_.escape(_curView.name))
debouncedSaveChanges();
});
+ $("#notes").click(function() {
+ if (gomNs.write_allowed) {
+ if (this.children[0].tagName == 'UL') {
+ var _el = document.createElement('textarea'),
+ _curView = gomNs.sessiondata.views[gomNs.sessiondata.view];
+ _el.innerHTML = _curView.notes ? _curView.notes : '';
+ $(_el).focusout(function() {
+ _curView.notes = this.value;
+ this.parentNode.innerHTML = '<ul><li>' + (this.value.length ? _.escape(_curView.notes).replace(/\n/gm,"</li><li>") : 'Annoter cette vue...' ) + '</ul>';
+ debouncedSaveChanges();
+ });
+ $(this).html(_el);
+ _el.focus();
+ _el.select();
+ }
+ }
+ });
gomNs.disChart = d3.select("#disciplines")
.append("svg:svg")
.attr("width", 475)
@@ -618,6 +650,10 @@
});
_html + '</ul>';
$("#gestvue").append(_html);
+ $("#nouvellevue").click(function() {
+ $("#plusdevues").slideToggle();
+ return false;
+ })
$("#widgetlist input").change(function() {
var _newWL = [];
$("#widgetlist input").each(function(_k, _e) {
@@ -631,5 +667,21 @@
});
gomNs.sessiondata.views[gomNs.sessiondata.view].hiddenWidgets = _newWL;
debouncedSaveChanges();
- })
+ });
+ $("#nouv_resrech").click(function() {
+ var _txt = prompt("Comment souhaitez-vous nommer votre nouvelle vue ?","Nouveaux résultats de recherche");
+ if (_txt !== null) {
+ addView('filter', _txt);
+ displayViewList();
+ }
+ return false;
+ });
+ $("#nouv_liste").click(function() {
+ var _txt = prompt("Comment souhaitez-vous nommer votre nouvelle vue ?","Nouvelle liste");
+ if (_txt !== null) {
+ addView('list', _txt);
+ displayViewList();
+ }
+ return false;
+ });
});