143 |
delphine |
1 |
<h1>Fiche</h1>
|
201 |
gduche |
2 |
<style>
|
|
|
3 |
#zone_contenu_fiche {
|
203 |
gduche |
4 |
border:solid 1px #DDD;
|
|
|
5 |
border-width:0px 1px 1px 1px;
|
201 |
gduche |
6 |
width:100%;
|
|
|
7 |
min-height:400px;
|
203 |
gduche |
8 |
clear:left;
|
|
|
9 |
|
201 |
gduche |
10 |
}
|
|
|
11 |
|
|
|
12 |
.module {margin: 0 1em 1em 0;}
|
|
|
13 |
.module .titre{ margin: 0.3em; padding-bottom: 4px; padding-left: 0.2em; cursor:pointer;}
|
|
|
14 |
.module .titre .ui-icon { float: right; }
|
|
|
15 |
.module .contenu { padding: 0.4em; }
|
|
|
16 |
|
|
|
17 |
.colonne {float:left; padding-bottom:100px; width:30%}
|
|
|
18 |
|
|
|
19 |
.ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; height: 50px !important; }
|
|
|
20 |
.ui-sortable-placeholder * { visibility: hidden; }
|
|
|
21 |
|
|
|
22 |
#zone_onglets ul li {list-style:none}
|
|
|
23 |
.lienToggle {cursor:pointer}
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
#dialog label, #dialog input { display:block; }
|
|
|
27 |
#dialog label { margin-top: 0.5em; }
|
|
|
28 |
#dialog input, #dialog textarea { width: 95%; }
|
211 |
aurelien |
29 |
#zone_onglets { margin-top: 1em; padding-right: 5px; border-width: 1px 1px 0 1px; border-radius:0; width:99%; font-size:12px}
|
203 |
gduche |
30 |
#zone_onglets li {float:left}
|
201 |
gduche |
31 |
#zone_onglets li .ui-icon-close { float: left; margin: 0.4em 0.2em 0 0; cursor: pointer; }
|
213 |
aurelien |
32 |
#zone_onglets #ongletEtPlus { cursor: pointer; float:right; z-index:2001;}
|
|
|
33 |
#zone_onglets #ongletEtPlus a { border-bottom: none;}
|
211 |
aurelien |
34 |
|
|
|
35 |
.elementMenuModules {
|
|
|
36 |
display:block;
|
213 |
aurelien |
37 |
border: 1px solid white;
|
211 |
aurelien |
38 |
width: 150px;
|
|
|
39 |
padding: 10px 10px 10px 25px;
|
|
|
40 |
margin:0px;
|
|
|
41 |
cursor: pointer;
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
.elementMenuModules:hover {
|
213 |
aurelien |
45 |
background-color: #FEBF01;
|
211 |
aurelien |
46 |
}
|
212 |
aurelien |
47 |
|
|
|
48 |
.elementMenuModulesSelectionne {
|
|
|
49 |
background-color: #F6AF39;
|
|
|
50 |
}
|
|
|
51 |
|
213 |
aurelien |
52 |
.menuModules {
|
|
|
53 |
left: 495px;
|
|
|
54 |
width: 187px;
|
|
|
55 |
position: absolute;
|
|
|
56 |
border: 1px solid #DCD1CC;
|
|
|
57 |
margin: 0px;
|
|
|
58 |
padding: 0px;
|
|
|
59 |
top: 37px;
|
|
|
60 |
z-index:2000;
|
|
|
61 |
background-color: white;
|
|
|
62 |
}
|
201 |
gduche |
63 |
</style>
|
|
|
64 |
|
203 |
gduche |
65 |
<div id="zone_onglets" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
|
|
|
66 |
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
|
|
|
67 |
<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#fiche">Accueil</a></li>
|
|
|
68 |
<li class="ui-state-default ui-corner-top"><a href="#fiche">Illustrations</a></li>
|
|
|
69 |
<li class="ui-state-default ui-corner-top"><a href="#fiche">Répartition</a></li>
|
|
|
70 |
<li class="ui-state-default ui-corner-top"><a href="#fiche">Wiki</a></li>
|
211 |
aurelien |
71 |
<li id="ongletEtPlus" class="ui-state-default ui-corner-top"><a href="#fiche">+</a></li>
|
203 |
gduche |
72 |
</ul>
|
211 |
aurelien |
73 |
<span id="conteneurMenuOnglets"></span>
|
203 |
gduche |
74 |
</div>
|
|
|
75 |
|
201 |
gduche |
76 |
<div id="zone_contenu_fiche">
|
203 |
gduche |
77 |
<div class="colonne">
|
|
|
78 |
<div id="illustrations" class="module ui-widget ui-widget-content ui-helper-clearfix ui-corner-all">
|
|
|
79 |
<h3 class="titre ui-widget-header ui-corner-all" id="titre-0">Illustrations</h3>
|
|
|
80 |
<span id="contenu-0" class="contenu">contenu-0</span>
|
|
|
81 |
</div>
|
|
|
82 |
|
|
|
83 |
<div id="repartition" class="module ui-widget ui-widget-content ui-helper-clearfix ui-corner-all">
|
|
|
84 |
<h3 class="titre ui-widget-header ui-corner-all" id="titre-0">Répartition</h3>
|
|
|
85 |
<span id="contenu-0" class="contenu">contenu-0</span>
|
|
|
86 |
</div>
|
|
|
87 |
|
|
|
88 |
<div id="wiki" class="module ui-widget ui-widget-content ui-helper-clearfix ui-corner-all">
|
|
|
89 |
<h3 class="titre ui-widget-header ui-corner-all" id="titre-0">Wiki<span class="lienToggle"></span></h3>
|
|
|
90 |
<span id="contenu-0" class="contenu">contenu-0</span>
|
|
|
91 |
</div>
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
</div>
|
201 |
gduche |
95 |
<div class="colonne"></div>
|
|
|
96 |
<div class="colonne"></div>
|
|
|
97 |
|
|
|
98 |
<br style="clear:left" />
|
|
|
99 |
</div>
|
|
|
100 |
|
|
|
101 |
<script type="text/Javascript">
|
|
|
102 |
var modules = Array();
|
211 |
aurelien |
103 |
var ongletsOuverts = Array();
|
201 |
gduche |
104 |
|
|
|
105 |
/** Classe Module
|
|
|
106 |
* Définit un module de type portlet
|
|
|
107 |
**/
|
203 |
gduche |
108 |
function Module(id, module, onglet, statique) {
|
201 |
gduche |
109 |
|
|
|
110 |
// Variables de classe : identifiant, titre, et le HTML du résumé à afficher dans le contenu
|
|
|
111 |
this.id = id;
|
203 |
gduche |
112 |
this.titre;
|
|
|
113 |
this.htmlResume;
|
201 |
gduche |
114 |
this.statique = statique;
|
|
|
115 |
|
|
|
116 |
// Les objets Portlet et Onglet que l'ont garde en mémoire pour pouvoir y accéder facilement
|
203 |
gduche |
117 |
this.portlet = module;
|
201 |
gduche |
118 |
this.onglet;
|
|
|
119 |
|
|
|
120 |
// creerPortlet
|
|
|
121 |
// Créer l'objet Portlet HTML à afficher et le stocker dans les variables de classe
|
|
|
122 |
this.creerPortlet = function() {
|
|
|
123 |
var objet = this;
|
|
|
124 |
|
203 |
gduche |
125 |
var titre = $(module).children('.titre');
|
201 |
gduche |
126 |
titre.className = 'titre ui-widget-header ui-corner-all';
|
|
|
127 |
titre.id = 'titre-' + this.id;
|
|
|
128 |
|
203 |
gduche |
129 |
var contenu = $(module).children('.contenu');
|
201 |
gduche |
130 |
contenu.id = 'contenu-' + this.id;
|
|
|
131 |
contenu.className ='contenu';
|
|
|
132 |
|
|
|
133 |
var lienToggle = document.createElement('span');
|
|
|
134 |
lienToggle.className = 'lienToggle ui-icon ui-icon-minusthick';
|
203 |
gduche |
135 |
$(titre).append(lienToggle);
|
201 |
gduche |
136 |
$(lienToggle).click(function() {
|
212 |
aurelien |
137 |
objet.afficherCacherModule();
|
201 |
gduche |
138 |
});
|
|
|
139 |
|
|
|
140 |
this.portlet = module;
|
|
|
141 |
return module;
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
// creerOnglet
|
|
|
145 |
// Créer l'objet Onglet HTML
|
|
|
146 |
this.creerOnglet = function() {
|
|
|
147 |
var objet = this;
|
|
|
148 |
|
203 |
gduche |
149 |
var a = $(onglet).find("a");
|
201 |
gduche |
150 |
|
|
|
151 |
// Gestion du clic sur le lien
|
|
|
152 |
// Comme les liens sont mis en place par jqueryui tabs, il faut ajouter une surcouche pour
|
|
|
153 |
// déplacer vers la page du module
|
|
|
154 |
$(a).click(function() {
|
211 |
aurelien |
155 |
// TODO : Changer l'url par celle du module et enregistrer la configuration actuelle des onglets.
|
201 |
gduche |
156 |
//$(location).attr('href',"http://www.google.fr");
|
|
|
157 |
});
|
|
|
158 |
|
|
|
159 |
if (!statique) {
|
|
|
160 |
var span = document.createElement('span');
|
|
|
161 |
span.className = "ui-icon ui-icon-close";
|
|
|
162 |
|
|
|
163 |
// Gestion de la fermeture de l'onglet
|
|
|
164 |
$(span).live( "click", function() {
|
212 |
aurelien |
165 |
objet.afficherCacherModule();
|
201 |
gduche |
166 |
});
|
|
|
167 |
|
203 |
gduche |
168 |
$(onglet).append(span);
|
201 |
gduche |
169 |
}
|
|
|
170 |
|
203 |
gduche |
171 |
this.onglet = onglet;
|
201 |
gduche |
172 |
}
|
|
|
173 |
|
|
|
174 |
// Initialisation de l'objet
|
|
|
175 |
this.creerPortlet();
|
|
|
176 |
this.creerOnglet();
|
|
|
177 |
|
|
|
178 |
// Accesseurs de la classe
|
|
|
179 |
this.getOnglet = function() {
|
|
|
180 |
return this.onglet;
|
|
|
181 |
}
|
|
|
182 |
|
|
|
183 |
this.getPortlet = function() {
|
|
|
184 |
|
|
|
185 |
return this.portlet;
|
|
|
186 |
}
|
211 |
aurelien |
187 |
|
|
|
188 |
// fonctions d'affichage et cachage (je sais pas si on dit ça comme ça) des onglets
|
|
|
189 |
this.afficherCacherModule = function() {
|
|
|
190 |
$(this.portlet).find(".lienToggle").toggleClass("ui-icon-plusthick");
|
|
|
191 |
$(this.portlet).find(".lienToggle").toggleClass("ui-icon-minusthick");
|
|
|
192 |
$(this.portlet).find(".contenu").toggle();
|
212 |
aurelien |
193 |
$(this.onglet).toggle();
|
211 |
aurelien |
194 |
}
|
|
|
195 |
|
201 |
gduche |
196 |
}
|
|
|
197 |
|
212 |
aurelien |
198 |
function afficherCacherMenuOnglets() {
|
211 |
aurelien |
199 |
if($("#conteneurMenuOnglets").html() != '') {
|
|
|
200 |
$("#conteneurMenuOnglets").html('');
|
|
|
201 |
} else {
|
|
|
202 |
console.log(ongletsOuverts);
|
|
|
203 |
var htmlMenu = '<ul class="menuModules">';
|
|
|
204 |
for (idOnglet in ongletsOuverts) {
|
212 |
aurelien |
205 |
var classe = "elementMenuModules";
|
|
|
206 |
if($(idOnglet).is(':visible')) {
|
|
|
207 |
classe += " elementMenuModulesSelectionne";
|
|
|
208 |
}
|
|
|
209 |
htmlMenu += '<li class="'+classe+'" rel="'+idOnglet+'" id="menu_module_'+idOnglet+'">'+ongletsOuverts[idOnglet].titre+'</li>';
|
211 |
aurelien |
210 |
}
|
|
|
211 |
htmlMenu += '</ul>';
|
|
|
212 |
$("#conteneurMenuOnglets").html(htmlMenu);
|
|
|
213 |
$("#conteneurMenuOnglets").toggle();
|
|
|
214 |
}
|
|
|
215 |
}
|
|
|
216 |
|
203 |
gduche |
217 |
//Initialisation
|
201 |
gduche |
218 |
$(document).ready(function() {
|
203 |
gduche |
219 |
i = 1;
|
201 |
gduche |
220 |
|
203 |
gduche |
221 |
//Parcourir la totalité des modules générés et les lier grâce à la classe Module
|
|
|
222 |
$(".module").each(function () {
|
201 |
gduche |
223 |
i++;
|
203 |
gduche |
224 |
identifiantOnglet = "#zone_onglets>ul>li:nth-child(" + i +")";
|
|
|
225 |
var module = new Module(i, this, $(identifiantOnglet));
|
211 |
aurelien |
226 |
module.titre = $(this).children('h3').text();
|
|
|
227 |
ongletsOuverts[identifiantOnglet] = module;
|
203 |
gduche |
228 |
});
|
201 |
gduche |
229 |
|
|
|
230 |
$( ".colonne" ).sortable({
|
|
|
231 |
connectWith: ".colonne"
|
|
|
232 |
});
|
|
|
233 |
|
|
|
234 |
$( ".colonne" ).disableSelection();
|
|
|
235 |
$('#zone_onglets').tabs();
|
211 |
aurelien |
236 |
$("#ongletEtPlus").click(function() {
|
212 |
aurelien |
237 |
afficherCacherMenuOnglets();
|
211 |
aurelien |
238 |
});
|
|
|
239 |
|
|
|
240 |
$('.elementMenuModules').live('click', function() {
|
|
|
241 |
var idOnglet = $(this).attr('rel');
|
|
|
242 |
var objet = ongletsOuverts[idOnglet];
|
212 |
aurelien |
243 |
objet.afficherCacherModule();
|
|
|
244 |
$(this).toggleClass("elementMenuModulesSelectionne");
|
211 |
aurelien |
245 |
})
|
201 |
gduche |
246 |
});
|
|
|
247 |
</script>
|