Changeset 25544 for main/trunk
- Timestamp:
- 2012-05-08T15:16:34+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/oran/js/documentmaker_scripts.js
r25363 r25544 91 91 //Create the container list and add it to the Document Basket div 92 92 var containerUL = document.createElement("UL"); 93 containerUL.setAttribute("class", "topLevel ");93 containerUL.setAttribute("class", "topLevelItem"); 94 94 dbDiv.appendChild(containerUL); 95 95 … … 147 147 newItem.sectionTitle = title; 148 148 newItem.appendChild(title); 149 newItem.setAttribute("class", depth == 0 ? "dragItem topLevel " : "dragItem");149 newItem.setAttribute("class", depth == 0 ? "dragItem topLevelItem" : "dragItem"); 150 150 newItem.textDiv = renderedDiv; 151 151 renderedDiv.parentItem = newItem; … … 222 222 function createNewDocumentArea() 223 223 { 224 //Create the necessary elements 225 var topLevelUL = document.createElement("UL"); 226 var topLevelLI = document.createElement("LI"); 227 var contentUL = document.createElement("UL"); 228 229 //Append the top-level list item to the top-level list 230 topLevelUL.appendChild(topLevelLI); 231 topLevelUL.setAttribute("class", "topLevel"); 232 233 //Set up the top-level item 234 topLevelLI.setAttribute("class", "dragItem topLevel"); 235 topLevelLI.childList = contentUL; 236 contentUL.parentItem = topLevelLI; 237 238 //Add a textDiv to the top-level item 239 var textDiv = createSectionTextDiv(null); 240 topLevelLI.textDiv = textDiv; 241 topLevelUL.appendChild(textDiv); 242 243 //Create a blank metadata table 244 //TODO: INSERT THIS! 245 246 //Add a title to the top-level item 247 var title = createSectionTitle(gs.text.dse.untitled); 248 topLevelLI.appendChild(title); 249 topLevelLI.sectionTitle = title; 250 251 createSectionMenu(topLevelLI); 252 setMouseOverAndOutFunctions(topLevelLI); 253 254 //Set up the placeholder for the first section 255 contentUL.setAttribute("class", "dragList"); 256 new YAHOO.util.DDTarget(contentUL); 257 258 //Create a placeholder and add it to first section 259 var placeHolder = createPlaceholder(null, contentUL, false); 260 contentUL.appendChild(placeHolder); 261 262 var dbDiv = document.getElementById("dbDiv"); 263 264 //Add elements to the page 265 if(dbDiv.firstChild) 266 { 267 dbDiv.insertBefore(topLevelUL, dbDiv.firstChild); 268 } 269 else 270 { 271 dbDiv.appendChild(topLevelUL); 272 } 273 insertAfter(contentUL, topLevelLI.textDiv); 274 275 //Correct any issues 276 updateFromTop(); 224 var createButton = document.getElementById("createNewDocumentButton"); 225 createButton.disabled = true; 226 227 var saveButton = document.getElementById("saveButton"); 228 saveButton.disabled = true; 229 230 var statusID = _statusBar.addStatus("Creating document..."); 231 232 var newID = "HASH" + gs.functions.hashString("" + (new Date()).getTime()); 233 234 var ajax = new gs.functions.ajaxRequest(); 235 ajax.open("POST", gs.xsltParams.library_name, true); 236 ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 237 ajax.onreadystatechange = function() 238 { 239 if(ajax.readyState == 4 && ajax.status == 200) 240 { 241 buildCollections([gs.cgiParams.p_c], [newID], function() 242 { 243 //Create the necessary elements 244 var topLevelUL = document.createElement("UL"); 245 var topLevelLI = document.createElement("LI"); 246 var contentUL = document.createElement("UL"); 247 248 //Append the top-level list item to the top-level list 249 topLevelUL.appendChild(topLevelLI); 250 topLevelUL.setAttribute("class", "topLevelItem"); 251 252 //Set up the top-level item 253 topLevelLI.setAttribute("class", "dragItem topLevelItem"); 254 topLevelLI.childList = contentUL; 255 topLevelLI.collection = gs.cgiParams.p_c; 256 topLevelLI.nodeID = newID; 257 contentUL.parentItem = topLevelLI; 258 259 //Add a textDiv to the top-level item 260 var textDiv = createSectionTextDiv(null); 261 textDiv.parentItem = topLevelLI; 262 topLevelLI.textDiv = textDiv; 263 topLevelUL.appendChild(textDiv); 264 265 //Create a blank metadata table 266 var metaTable = document.createElement("TABLE"); 267 metaTable.setAttribute("id", "meta" + newID); 268 textDiv.insertBefore(metaTable, textDiv.firstChild); 269 var titleMetaRow = document.createElement("TR"); 270 var titleMetaNameCell = document.createElement("TD"); 271 titleMetaNameCell.innerHTML = "dc.Title"; 272 titleMetaNameCell.setAttribute("class", "metaTableCellName"); 273 var titleMetaValueCell = document.createElement("TD"); 274 titleMetaValueCell.setAttribute("class", "metaTableCell editable"); 275 titleMetaValueCell.innerHTML = "UNTITLED DOCUMENT"; 276 titleMetaRow.appendChild(titleMetaNameCell); 277 titleMetaRow.appendChild(titleMetaValueCell); 278 metaTable.appendChild(titleMetaRow); 279 addFunctionalityToTable(metaTable); 280 281 //Add a title to the top-level item 282 var title = createSectionTitle(gs.text.dse.untitled); 283 topLevelLI.appendChild(title); 284 topLevelLI.sectionTitle = title; 285 286 createSectionMenu(topLevelLI); 287 setMouseOverAndOutFunctions(topLevelLI); 288 289 //Set up the placeholder for the first section 290 contentUL.setAttribute("class", "dragList"); 291 new YAHOO.util.DDTarget(contentUL); 292 293 //Create a placeholder and add it to first section 294 var placeHolder = createPlaceholder(null, contentUL, false); 295 contentUL.appendChild(placeHolder); 296 297 //Add elements to the page 298 var dbDiv = document.getElementById("dbDiv"); 299 if(dbDiv.firstChild) 300 { 301 dbDiv.insertBefore(topLevelUL, dbDiv.firstChild); 302 } 303 else 304 { 305 dbDiv.appendChild(topLevelUL); 306 } 307 insertAfter(contentUL, topLevelLI.textDiv); 308 309 //Correct any issues 310 updateFromTop(); 311 }); 312 createButton.disabled = false; 313 saveButton.disabled = false; 314 _statusBar.removeStatus(statusID); 315 } 316 else if (ajax.readyState == 4) 317 { 318 createButton.disabled = false; 319 saveButton.disabled = false; 320 _statusBar.removeStatus(statusID); 321 } 322 } 323 console.log('[{"operation":"createDocument", "oid":"' + newID + '", "collection":"' + gs.cgiParams.p_c + '"}]'); 324 ajax.send('a=g&rt=r&s=DocumentExecuteTransaction&s1.transactions=[{"operation":"createDocument", "oid":"' + newID + '", "collection":"' + gs.cgiParams.p_c + '"}]'); 277 325 } 278 326 … … 640 688 } 641 689 642 if(!gs.functions.hasClass(current, "topLevel "))690 if(!gs.functions.hasClass(current, "topLevelItem")) 643 691 { 644 692 current.nodeID = currentDocument + "." + pos;
Note:
See TracChangeset
for help on using the changeset viewer.