First version of threaded conversation editor in the updated resource editor.

git-svn-id: https://andors-trail.googlecode.com/svn/trunk@72 08aca716-68be-ccc6-4d58-36f5abd142ac
This commit is contained in:
oskar.wiksten
2011-05-03 22:15:45 +00:00
parent 02454b5a78
commit b5a3f10e6d
27 changed files with 1515 additions and 601 deletions

View File

@@ -6,7 +6,18 @@ IncludeJavascript("FieldList.js");
IncludeJavascript("DataStore.js");
IncludeJavascript("ImageSelector.js");
IncludeJavascript("EditorTabs.js");
IncludeJavascript("EditorFunctions.js");
IncludeJavascript("ImportExport.js");
IncludeJavascript("Editor_ActorCondition.js");
IncludeJavascript("Editor_Quest.js");
IncludeJavascript("Editor_Item.js");
IncludeJavascript("Editor_Droplist.js");
IncludeJavascript("Editor_Conversation.js");
IncludeJavascript("Editor_Monster.js");
IncludeJavascript("inc/jquery.shorten.min.js");
IncludeJavascript("inc/jquery.dynatree.min.js");
var model;
@@ -18,201 +29,6 @@ var equipConditionsDialog;
var droplistItemDialog;
function checkboxHidesElement(checkbox, element, visibleCondition) {
checkbox.change(function () {
if (checkbox.attr("checked")) {
element.fadeIn("slow");
} else {
element.fadeOut("slow");
}
});
var visible = bool(visibleCondition);
checkbox.attr("checked", visible);
element.toggle(visible);
}
function bool(v) {
if (typeof(v) == 'undefined') return false;
if (v == '') return false;
if (v == '0') return false;
if (v == 'false') return false;
return true;
}
function setInputFieldsToObjectValues(div, obj) {
div.find("input,select,textarea").each(function() {
$(this).val(obj[$(this).attr("id")]);
});
div.find("input:checkbox").each(function() {
$(this).attr("checked", bool(obj[$(this).attr("id")]));
});
}
function bindInputFieldChangesToObject(div, obj) {
div.find("input,select,textarea").unbind("change").change(function() {
obj[$(this).attr("id")] = $(this).val();
});
div.find("input:checkbox").unbind("change").change(function() {
obj[$(this).attr("id")] = $(this).attr("checked") ? 1 : 0;
});
}
function applyEditorBindingsForObject(div, obj) {
div.find("input").addClass("ui-widget-content ui-corner-all");
setInputFieldsToObjectValues(div, obj);
bindInputFieldChangesToObject(div, obj);
}
function applyCommonEditorBindings(div, obj, dataStore) {
applyEditorBindingsForObject(div, obj);
div.find("#" + dataStore.nameField).change(function() { dataStore.onNameChanged(obj, $(this).val()); });
}
function createMonsterEditor(obj) {
var div = $( "#templates #editMonster" ).clone();
applyCommonEditorBindings(div, obj, model.monsters);
checkboxHidesElement(div.find('#hasConversation'), div.find('#hasConversationDisplay'), obj.phraseID);
checkboxHidesElement(div.find('#hasCombat'), div.find('#hasCombatDisplay'), obj.attackChance);
checkboxHidesElement(div.find('#hasCritical'), div.find('#hasCriticalDisplay'), obj.criticalChance || obj.criticalMultiplier);
checkboxHidesElement(div.find('#hasHitEffect'), div.find('#hasHitEffectDisplay'), obj.hasHitEffect);
imageSelector.imageify(div.find('#monsterimage'), div.find('#iconID'), 'monsters');
bindFieldToDataStore( $( "#droplistID", div ), model.droplists , function(obj) { return obj.id; } );
var createNewCondition = function() { return { chance: 100, magnitude: 1 }; }
if (!obj.onHit_conditionsSource) obj.onHit_conditionsSource = [];
if (!obj.onHit_conditionsTarget) obj.onHit_conditionsTarget = [];
var setupEditor = function(div) {
bindFieldToDataStore( $( "#condition", div ), model.actorEffects , function(obj) { return obj.id; } );
}
applyTableEditor( $( "#onHit_conditionsSource", div ) , onHitConditionsDialog, obj.onHit_conditionsSource, createNewCondition, setupEditor);
applyTableEditor( $( "#onHit_conditionsTarget", div ) , onHitConditionsDialog, obj.onHit_conditionsTarget, createNewCondition, setupEditor);
return div;
}
function createItemEditor(obj) {
var div = $( "#templates #editItem" ).clone();
applyCommonEditorBindings(div, obj, model.items);
checkboxHidesElement(div.find('#hasEquipEffect'), div.find('#hasEquipEffectDisplay'), obj.hasEquipEffect);
checkboxHidesElement(div.find('#hasUseEffect'), div.find('#hasUseEffectDisplay'), obj.hasUseEffect);
checkboxHidesElement(div.find('#equip_hasCritical'), div.find('#equip_hasCriticalDisplay'), obj.equip_criticalChance || obj.equip_criticalMultiplier);
checkboxHidesElement(div.find('#hasHitEffect'), div.find('#hasHitEffectDisplay'), obj.hasHitEffect);
checkboxHidesElement(div.find('#hasKillEffect'), div.find('#hasKillEffectDisplay'), obj.hasKillEffect);
imageSelector.imageify(div.find('#itemimage'), div.find('#iconID'), 'items');
var createNewCondition = function() { return { chance: 100, magnitude: 1 }; }
if (!obj.equip_conditions) obj.equip_conditions = [];
if (!obj.use_conditionsSource) obj.use_conditionsSource = [];
if (!obj.hit_conditionsSource) obj.hit_conditionsSource = [];
if (!obj.hit_conditionsTarget) obj.hit_conditionsTarget = [];
if (!obj.kill_conditionsSource) obj.kill_conditionsSource = [];
var setupEditor = function(div) {
bindFieldToDataStore( $( "#condition", div ), model.actorEffects , function(obj) { return obj.id; } );
}
applyTableEditor( $( "#equip_conditions", div ) , equipConditionsDialog, obj.equip_conditions, createNewCondition, setupEditor);
applyTableEditor( $( "#use_conditionsSource", div ) , onHitConditionsDialog, obj.use_conditionsSource, createNewCondition, setupEditor);
applyTableEditor( $( "#hit_conditionsSource", div ) , onHitConditionsDialog, obj.hit_conditionsSource, createNewCondition, setupEditor);
applyTableEditor( $( "#hit_conditionsTarget", div ) , onHitConditionsDialog, obj.hit_conditionsTarget, createNewCondition, setupEditor);
applyTableEditor( $( "#kill_conditionsSource", div ) , onHitConditionsDialog, obj.kill_conditionsSource, createNewCondition, setupEditor);
return div;
}
function bindFieldToDataStore(field, dataStore, converter) {
var dataCallback = function(request, response) {
var result = [];
var pattern = new RegExp(request.term, "i");
dataStore.items.forEach(function(obj) {
var name = converter(obj);
if (name.match(pattern)) {
result.push(name);
}
});
response(result);
};
field.autocomplete( "destroy" ).autocomplete({ source: dataCallback, minLength: 0 });
}
function createStatusEffectEditor(obj) {
var div = $( "#templates #editActorEffect" ).clone();
applyCommonEditorBindings(div, obj, model.actorEffects);
checkboxHidesElement(div.find('#hasRoundEffect'), div.find('#hasRoundEffectDisplay'), obj.hasRoundEffect);
checkboxHidesElement(div.find('#hasFullRoundEffect'), div.find('#hasFullRoundEffectDisplay'), obj.hasFullRoundEffect);
checkboxHidesElement(div.find('#hasAbilityEffect'), div.find('#hasAbilityEffectDisplay'), obj.hasAbilityEffect);
checkboxHidesElement(div.find('#hasCritical'), div.find('#hasCriticalDisplay'), obj.criticalChance || obj.criticalMultiplier);
imageSelector.imageify(div.find('#statuseffectimage'), div.find('#iconID'), 'effects');
return div;
}
function applyTableEditor(table, dialog, array, templateFunction, editorSetup) {
var updateRowText = function(row, obj) {
$( "td", row ).each(function() {
var id = $( this ).attr("id");
var val = obj[id];
val = val ? val : "";
$( "td#" + id, row ).text(val).shorten({
width: '200'
}).css('display','');
});
};
var addToList = function(obj) {
var row = $( "<tr>" );
table.find("th").each(function() {
var id = $( this ).attr("id");
row.append( $( "<td>" ).attr("id", id) );
});
updateRowText(row, obj);
table.append(row);
row.click(function() {
applyEditorBindingsForObject( dialog, obj );
if (editorSetup) { editorSetup(dialog); }
dialog.unbind( "dialogclose" ).bind( "dialogclose", function() {
updateRowText(row, obj);
});
dialog.dialog( "open" );
});
return row;
};
table.parent().find("#add").button().click(function() {
var obj = templateFunction();
array.push( obj );
addToList( obj ).click();
});
table.addClass("ui-corner-all");
$( "thead", table ).addClass("ui-widget-header");
array.forEach(addToList);
}
function createQuestEditor(obj) {
var div = $( "#templates #editQuest" ).clone(true);
applyCommonEditorBindings(div, obj, model.quests);
if (!obj.stages) obj.stages = [];
var array = obj.stages;
var createNewStage = function() {
var nextProgress;
if (array.length > 0) { nextProgress = parseInt(array[array.length - 1].progress) + 10; }
if (!nextProgress) { nextProgress = 10; }
return { progress: nextProgress };
};
applyTableEditor( $( "#stages", div ) , questlogDialog, array, createNewStage, function() {});
return div;
}
function createDroplistEditor(obj) {
var div = $( "#templates #editDroplist" ).clone(true);
applyCommonEditorBindings(div, obj, model.droplists);
if (!obj.items) obj.items = [];
var createNewDroplistItem = function() { return { quantity: 1, chance: 100 } };
var setupEditor = function(div) {
bindFieldToDataStore( $( "#itemID", div ), model.items , function(obj) { return obj.searchTag; } );
}
applyTableEditor( $( "#items", div ) , droplistItemDialog, obj.items, createNewDroplistItem, setupEditor);
return div;
}
function openTabForObject(obj, dataStore) {
tabs.openTabForObject(obj, dataStore.objectTypename, obj[dataStore.nameField]);
}
@@ -239,30 +55,6 @@ function bindObjectsToItemList(itemListDiv, dataStore) {
};
}
function exportIfExists(dataStore, div) {
var exists = false;
if (dataStore && dataStore.items.length > 0) exists = true;
div.toggle(exists);
if (!exists) { return; }
var exportData = dataStore.serialize();
$( "#value" , div ).val(exportData);
}
function prepareImport(dataStore, div) {
var importButton = $( "#import", div );
var textarea = $( "#value", div );
importButton.button({ disabled: true }).click(function() {
if (!textarea.val()) return;
dataStore.deserialize(textarea.val());
div.hide('slow');
});
textarea.val("").change(function() {
var disabled = $(this).val() ? false : true;
importButton.button( "option", "disabled", disabled );
});
}
function bindEditorType(dataStore, div, createObjectEditor, newObjectCreator) {
tabs.registerEditorType(dataStore.objectTypename, createObjectEditor);
@@ -277,10 +69,30 @@ function bindEditorType(dataStore, div, createObjectEditor, newObjectCreator) {
});
}
function addExampleModelItems(model) {
model.actorConditions.add({id: "bless", name: "Bless", iconID: "items_tiles:318", hasAbilityEffect: 1, attackChance: 15, blockChance: 5});
model.actorConditions.add({id: "poison_weak", name: "Weak Poison", iconID: "items_tiles:340", hasRoundEffect: 1, round_visualEffectID: 2, round_boostHP_Min: -1, round_boostHP_Max: -1});
model.quests.add({id: "testQuest", name: "Test quest", stages: [ { progress: 10, logText: "Stage 10"} , { progress: 20, logText: "Stage 20", finishesQuest: 1 } ] });
model.items.add({iconID: "items_tiles:70", name: "Test item", searchTag: "item0", category: 0, baseMarketCost: 51, hasEquipEffect: 1, equip_attackChance: 10, equip_attackDamage_Min: 2, equip_attackDamage_Max: 4});
model.items.add({iconID: "items_tiles:266", name: "Ring of damage +1", searchTag: "dmg_ring1", category: 7, baseMarketCost: 62, hasEquipEffect: 1, equip_attackDamage_Min: 1, equip_attackDamage_Max: 1});
model.droplists.add({id: "merchant1", items: [ { itemID: 'dmg_ring1', quantity_Min: 4, quantity_Max: 5, chance: 100 } , { itemID: 'item0', quantity_Min: 1, quantity_Max: 1, chance: 100 } ] } );
model.dialogue.add({id: "mikhail_default", message: 'Anything else I can help you with?', replies: [ { text: 'Do you have any tasks for me?', nextPhraseID: 'mikhail_tasks' }, { text: 'Is there anything else you can tell me about Andor?', nextPhraseID: 'mikhail_andor1' } ]});
model.dialogue.add({id: 'mikhail_andor1', message: 'As I said, Andor went out yesterday and hasn\'t been back since. I\'m starting to worry about him. Please go look for your brother, he said he would only be out a short while.'});
model.dialogue.add({id: 'mikhail_tasks', message: 'Oh yes, there were some things I need help with, bread and rats. Which one would you like to talk about?'});
model.monsters.add({name: "Small ant", iconID: "monsters_insects:2", maxHP: 30, size: '1x1'});
model.monsters.add({name: "Red ant", iconID: "monsters_insects:3", maxHP: 20, size: '1x1'});
model.monsters.add({name: "Wasp", iconID: "monsters_insects:1", maxHP: 10, size: '1x1'});
}
function startEditor() {
model = {
actorEffects: new DataStore('effect', new FieldList("[id|name|iconID|isStacking|"
actorConditions: new DataStore('actorcondition', new FieldList("[id|name|iconID|isStacking|"
+ "hasRoundEffect|round_visualEffectID|round_boostHP_Min|round_boostHP_Max|round_boostAP_Min|round_boostAP_Max|"
+ "hasFullRoundEffect|fullround_visualEffectID|fullround_boostHP_Min|fullround_boostHP_Max|fullround_boostAP_Min|fullround_boostAP_Max|"
+ "hasAbilityEffect|boostMaxHP|boostMaxAP|moveCostPenalty|attackCost|attackChance|criticalChance|criticalMultiplier|attackDamage_Min|attackDamage_Max|blockChance|damageResistance|"
@@ -293,35 +105,21 @@ function startEditor() {
+ "hasKillEffect|kill_boostHP_Min|kill_boostHP_Max|kill_boostAP_Min|kill_boostAP_Max|kill_conditionsSource[condition|magnitude|duration|chance|]|"
+ "];"))
,droplists: new DataStore('droplist', new FieldList("[id|items[itemID|quantity_Min|quantity_Max|chance|]|];"), 'id')
,dialogue: new DataStore('dialogue', new FieldList("[id|name|];"))
,dialogue: new DataStore('dialogue', new FieldList("[id|message|progressQuest|rewardDropListID|replies[text|nextPhraseID|requires_Progress|requires_itemID|requires_Quantity|]|];"), 'id')
,monsters: new DataStore('monster', new FieldList("[iconID|name|tags|size|maxHP|maxAP|moveCost|attackCost|attackChance|criticalChance|criticalMultiplier|attackDamage_Min|attackDamage_Max|blockChance|damageResistance|droplistID|phraseID|"
+ "hasHitEffect|onHit_boostHP_Min|onHit_boostHP_Max|onHit_boostAP_Min|onHit_boostAP_Max|onHit_conditionsSource[condition|magnitude|duration|chance|]|onHit_conditionsTarget[condition|magnitude|duration|chance|]|"
+ "];"))
};
model.actorEffects.add({id: "bless", name: "Bless", iconID: "items_tiles:318", hasAbilityEffect: 1, attackChance: 15, blockChance: 5});
model.actorEffects.add({id: "poison_weak", name: "Weak Poison", iconID: "items_tiles:340", hasRoundEffect: 1, round_visualEffectID: 2, round_boostHP_Min: -1, round_boostHP_Max: -1});
model.quests.add({id: "testQuest", name: "Test quest", stages: [ { progress: 10, logText: "Stage 10"} , { progress: 20, logText: "Stage 20", finishesQuest: 1 } ] });
model.items.add({iconID: "items_tiles:70", name: "Test item", searchTag: "item0", category: 0, baseMarketCost: 51, hasEquipEffect: 1, equip_attackChance: 10, equip_attackDamage_Min: 2, equip_attackDamage_Max: 4});
model.items.add({iconID: "items_tiles:266", name: "Ring of damage +1", searchTag: "dmg_ring1", category: 7, baseMarketCost: 62, hasEquipEffect: 1, equip_attackDamage_Min: 1, equip_attackDamage_Max: 1});
model.droplists.add({id: "merchant1", items: [ { itemID: 'dmg_ring1', quantity_Min: 4, quantity_Max: 5, chance: 100 } , { itemID: 'item0', quantity_Min: 1, quantity_Max: 1, chance: 100 } ] } );
model.monsters.add({name: "Small ant", iconID: "monsters_insects:2", maxHP: 30, size: '1x1'});
model.monsters.add({name: "Red ant", iconID: "monsters_insects:3", maxHP: 20, size: '1x1'});
model.monsters.add({name: "Wasp", iconID: "monsters_insects:1", maxHP: 10, size: '1x1'});
addExampleModelItems(model);
$( "#left #tools" ).accordion({ fillSpace: true });
tabs = new EditorTabs( $( "#center #tabs" ) );
bindEditorType(model.actorEffects, $( "#tools #effectlist" ), createStatusEffectEditor, function() {
return {name: "New Effect", id: 'new_effect' };
bindEditorType(model.actorConditions, $( "#tools #actorconditionlist" ), createActorConditionEditor, function() {
return {name: "New Condition", id: 'new_condition' };
});
bindEditorType(model.quests, $( "#tools #questlist" ), createQuestEditor, function() {
return {name: "New Quest", id: 'new_quest' };
@@ -332,39 +130,17 @@ function startEditor() {
bindEditorType(model.droplists, $( "#tools #droplist" ), createDroplistEditor, function() {
return {id: "new_droplist" };
});
bindEditorType(model.dialogue, $( "#tools #conversationlist" ), createConversationEditor, function() {
return {id: "new_conversation" };
});
bindEditorType(model.monsters, $( "#tools #monsterlist" ), createMonsterEditor, function() {
return {name: "New Monster", maxAP: 10, attackCost: 5, moveCost: 5 };
});
var importExportDialog;
$( "#buttons #import" )
.button()
.click(function() {
importExportDialog.dialog({ title: "Import data" });
$( "div", importExportDialog ).show();
prepareImport(model.actorEffects, $( "#statuseffects", importExportDialog ));
prepareImport(model.quests, $( "#quests", importExportDialog ));
prepareImport(model.items, $( "#items", importExportDialog ));
prepareImport(model.droplists, $( "#droplists", importExportDialog ));
prepareImport(model.dialogue, $( "#dialogue", importExportDialog ));
prepareImport(model.monsters, $( "#monsters", importExportDialog ));
importExportDialog.dialog( "open" );
});
$( "#buttons #export" )
.button()
.click(function() {
importExportDialog.dialog({ title: "Export data" });
exportIfExists(model.actorEffects, $( "#statuseffects", importExportDialog ));
exportIfExists(model.quests, $( "#quests", importExportDialog ));
exportIfExists(model.items, $( "#items", importExportDialog ));
exportIfExists(model.droplists, $( "#droplists", importExportDialog ));
exportIfExists(model.dialogue, $( "#dialogue", importExportDialog ));
exportIfExists(model.monsters, $( "#monsters", importExportDialog ));
$( "#import", importExportDialog ).hide();
importExportDialog.dialog( "open" );
});
$( "#buttons #import" ).button().click( showImportDialog );
$( "#buttons #export" ).button().click( showExportDialog );
var defaultButtons = {
Close: function() { $( this ).dialog( "close" ); }
@@ -417,7 +193,7 @@ function startEditor() {
imageSelector = new ImageSelector("http://andors-trail.googlecode.com/svn/trunk/AndorsTrail/res/drawable/", $( "#dialog-images" ) );
imageSelector.add(new TilesetImage("items_tiles", {x: 14, y:30}, {x:34, y:34}, [ 'items', 'effects' ] ));
imageSelector.add(new TilesetImage("items_tiles", {x: 14, y:30}, {x:34, y:34}, [ 'items', 'conditions' ] ));
imageSelector.add(new TilesetImage("monsters_armor1", {x: 1, y:1}, undefined, [ 'monsters' ] ));
imageSelector.add(new TilesetImage("monsters_demon1", {x: 1, y:1}, {x:64, y:64}, [ 'monsters' ] ));
imageSelector.add(new TilesetImage("monsters_demon2", {x: 1, y:1}, undefined, [ 'monsters' ] ));

View File

@@ -36,6 +36,11 @@ function DataStore(objectTypename, fieldList, nameField) {
}
this.get = function(index) { return this.items[index]; }
this.clear = function() { this.items = {}; }
this.findById = function(id) {
for (var i = 0; i < this.items.length; ++i) {
if (this.items[i].id == id) return this.items[i];
}
}
this.onAdded = function(obj) { }
this.onNameChanged = function(obj, name) { }

View File

@@ -0,0 +1,134 @@
function changeHidesElement(changedElement, elementToHide, visibilityEvaluator) {
changedElement.change(function () {
if (visibilityEvaluator()) {
elementToHide.fadeIn("slow");
} else {
elementToHide.fadeOut("slow");
}
});
elementToHide.toggle(visibilityEvaluator());
}
function checkboxHidesElement(checkbox, element, visibleCondition) {
var visible = bool(visibleCondition);
checkbox.attr("checked", visible);
var evaluator = function() { return checkbox.attr("checked"); };
changeHidesElement(checkbox, element, evaluator);
}
function checkboxShowsElement(checkbox, element, visibleCondition) {
var visible = !bool(visibleCondition);
checkbox.attr("checked", visible);
var evaluator = function() { return !checkbox.attr("checked"); };
changeHidesElement(checkbox, element, evaluator);
}
function bool(v) {
if (typeof(v) == 'undefined') return false;
if (v == '') return false;
if (v == '0') return false;
if (v == 'false') return false;
return true;
}
function setInputFieldsToObjectValues(div, obj) {
div.find("input,select,textarea").each(function() {
$(this).val(obj[$(this).attr("id")]);
});
div.find("input:checkbox").each(function() {
$(this).attr("checked", bool(obj[$(this).attr("id")]));
});
}
function bindInputFieldChangesToObject(div, obj) {
div.find("input,select,textarea").unbind("change").change(function() {
obj[$(this).attr("id")] = $(this).val();
});
div.find("input:checkbox").unbind("change").change(function() {
obj[$(this).attr("id")] = $(this).attr("checked") ? 1 : 0;
});
}
function applyEditorBindingsForObject(div, obj) {
div.find("input").addClass("ui-widget-content ui-corner-all");
setInputFieldsToObjectValues(div, obj);
bindInputFieldChangesToObject(div, obj);
}
function applyCommonEditorBindings(div, obj, dataStore) {
applyEditorBindingsForObject(div, obj);
if (dataStore) {
div.find("#" + dataStore.nameField).change(function() { dataStore.onNameChanged(obj, $(this).val()); });
}
}
function bindFieldToDataStore(field, dataStore, converter) {
var dataCallback = function(request, response) {
var result = [];
var pattern = new RegExp(request.term, "i");
dataStore.items.forEach(function(obj) {
var name = converter(obj);
if (name.match(pattern)) {
result.push(name);
}
});
response(result);
};
field.autocomplete( "destroy" ).autocomplete({
source: dataCallback,
minLength: 0,
select: function(event, ui) {
field.val(ui.item.value);
field.change();
}
});
}
function applyTableEditor(input) {
var updateRowText = function(row, obj) {
$( "td", row ).each(function() {
var id = $( this ).attr("id");
var val = obj[id];
val = val ? val : "";
$( this ).text(val).shorten({
width: '200'
}).css('display','');
});
};
var onItemSelected = input.onItemSelected ? input.onItemSelected : function(obj, row) {
var dialog = input.dialog;
applyEditorBindingsForObject( dialog, obj );
if (input.editorSetup) { input.editorSetup(dialog); }
dialog.unbind( "dialogclose" ).bind( "dialogclose", function() {
updateRowText(row, obj);
});
dialog.dialog( "open" );
};
var table = input.table;
var addToList = function(obj) {
var row = $( "<tr>" );
table.find("th").each(function() {
var id = $( this ).attr("id");
row.append( $( "<td>" ).attr("id", id) );
});
updateRowText(row, obj);
table.append(row);
row.click(function() { onItemSelected(obj, row); });
return row;
};
table.parent().find("#add").button().unbind("click").click(function() {
var obj = input.templateFunction();
input.array.push( obj );
if (input.onItemAdded) { input.onItemAdded(obj); }
addToList( obj ).click();
});
table.addClass("ui-corner-all");
$( "thead", table ).addClass("ui-widget-header");
$( "tbody", table ).empty();
input.array.forEach(addToList);
}

View File

@@ -0,0 +1,12 @@
function createActorConditionEditor(obj) {
var div = $( "#templates #editActorCondition" ).clone();
applyCommonEditorBindings(div, obj, model.actorConditions);
checkboxHidesElement(div.find('#hasRoundEffect'), div.find('#hasRoundEffectDisplay'), obj.hasRoundEffect);
checkboxHidesElement(div.find('#hasFullRoundEffect'), div.find('#hasFullRoundEffectDisplay'), obj.hasFullRoundEffect);
checkboxHidesElement(div.find('#hasAbilityEffect'), div.find('#hasAbilityEffectDisplay'), obj.hasAbilityEffect);
checkboxHidesElement(div.find('#hasCritical'), div.find('#hasCriticalDisplay'), obj.criticalChance || obj.criticalMultiplier);
imageSelector.imageify(div.find('#actorconditionimage'), div.find('#iconID'), 'conditions');
return div;
}

View File

@@ -0,0 +1,302 @@
function createConversationEditor(obj) {
var div = $( "#templates #editDialogue" ).clone(true);
var treeDiv = $ ( "#dialogueTree", div );
treeDiv.dynatree({
title: "Conversation flow"
,imagePath: 'img'
});
var tree = treeDiv.dynatree("getTree");
var rootNode = treeDiv.dynatree("getRoot");
updatePhraseTreeNodesBelow(tree, rootNode, obj);
treeDiv.dynatree({
onActivate: function(node) {
onConversationPhraseSelected(div, node.data.model, tree);
}
});
tree.activateKey(obj.id);
return div;
}
function getPhraseByPhraseID(phraseID) {
if (!phraseID) return;
return model.dialogue.findById(phraseID);
}
function onConversationPhraseSelected(div, obj, tree) {
var dialoguePhrase = $( "#dialoguePhrase", div );
var dialogueReply = $( "#dialogueReply", div );
var dialoguePhraseReplies = $( "#dialoguePhraseReplies", div );
dialogueReply.hide();
dialoguePhrase.hide();
dialoguePhraseReplies.hide();
if (!obj) return;
var treeNodeKey = getTreeNodeKey(obj);
var treeNode = tree.getNodeByKey(treeNodeKey);
if (!treeNode) {
treeNode = updatePhraseTreeNodesBelow(tree, tree.getRoot(), obj, true);
}
treeNode.activateSilently();
applyCommonEditorBindings(div, obj, model.dialogue);
if (obj.isPhrase) {
buildEditorForPhrase(div, obj, tree, treeNode);
} else {
buildEditorForReply(div, obj, tree, treeNode);
}
}
// ========================================================
// Set up editor for NPC phrases
function buildEditorForPhrase(div, phrase, tree, treeNode) {
var dialoguePhrase = $( "#dialoguePhrase", div );
var dialoguePhraseReplies = $( "#dialoguePhraseReplies", div );
checkboxHidesElement( $( '#hasProgressQuest', dialoguePhrase ), $( '#hasProgressQuestDisplay', dialoguePhrase ), phrase.progressQuest);
checkboxHidesElement( $( '#hasRewardDroplist', dialoguePhrase ), $( '#hasRewardDroplistDisplay', dialoguePhrase ), phrase.rewardDropListID);
bindFieldToDataStore( $( "#progressQuest", dialoguePhrase ), model.quests , function(obj) { return obj.id; } );
bindFieldToDataStore( $( "#rewardDropListID", dialoguePhrase ), model.droplists , function(obj) { return obj.id; } );
var reloadReplyTable = function() {
applyTableEditor({
table: $( "#replies", dialoguePhraseReplies ),
array: phrase.replies,
templateFunction: function() { return createReplyForPhrase(phrase); },
onItemSelected: function(obj) {
onConversationPhraseSelected(div, obj, tree);
},
onItemAdded: function(addedObject) {
updatePhraseReplyTreeNodesBelow(tree, treeNode, phrase);
}
});
}
reloadReplyTable();
var hasOnlyNextReply = $( '#hasOnlyNextReply', dialoguePhraseReplies );
checkboxHidesElement( hasOnlyNextReply, $( '#hasOnlyNextReplyDisplay', dialoguePhraseReplies ), phrase.hasOnlyNextReply);
checkboxShowsElement( hasOnlyNextReply, $( '#hasRepliesDisplay', dialoguePhraseReplies ), !phrase.hasOnlyNextReply);
hasOnlyNextReply.change(function() {
if ( $(this).attr("checked") ) {
var nextReply = createReplyForPhrase(phrase);
nextReply.text = 'N';
phrase.replies = [ nextReply ];
} else {
phrase.replies = [ ];
reloadReplyTable();
}
updatePhraseReplyTreeNodesBelow(tree, treeNode, phrase);
});
var nextPhraseID = $( "#nextPhraseID", dialoguePhraseReplies );
nextPhraseID.unbind("change").change(function() {
phrase.replies[0].nextPhraseID = $( this ).val();
updatePhraseReplyTreeNodesBelow(tree, treeNode, phrase);
});
if (phrase.hasOnlyNextReply) {
nextPhraseID.val(phrase.replies[0].nextPhraseID);
}
$( "#followNextReply", dialoguePhraseReplies ).button().unbind('click').click(function() {
openNextPhrase(nextPhraseID.val(), div, phrase.replies[0], tree);
});
$( '#message', dialoguePhrase ).change(function() { treeNode.setTitle( getPhraseNodeText(phrase) ); });
dialoguePhrase.show();
dialoguePhraseReplies.show();
}
function createReplyForPhrase(phrase) {
return {
id: phrase.id,
isPhrase: false,
phrase: phrase
};
}
function openNextPhrase(nextPhraseID, div, reply, tree) {
var createNewPhrase = true;
var phrase;
if (nextPhraseID) {
phrase = getPhraseByPhraseID(nextPhraseID);
if (phrase) {
createNewPhrase = false;
}
} else {
nextPhraseID = generatePhraseID(reply.phrase.id);
}
if (createNewPhrase) {
phrase = { id: nextPhraseID, isPhrase: true };
model.dialogue.add(phrase);
}
reply.nextPhraseID = nextPhraseID;
var treeNodeKey = getTreeNodeKey(reply.phrase);
var treeNode = tree.getNodeByKey(treeNodeKey);
updatePhraseReplyTreeNodesBelow(tree, treeNode, reply.phrase);
//alert("followNextReply: " + nextPhraseID);
onConversationPhraseSelected(div, phrase, tree);
}
var phraseIDPattern = new RegExp("^(.*)(\d+)$", 'g');
function generatePhraseID(previousPhraseID) {
var suffix;
var n = 1;
var match = /^(.*)(\d+)$/(previousPhraseID);
if (match) {
suffix = match[1];
n = parseInt(match[2]) + 1;
} else {
suffix = previousPhraseID + "_";
}
for (var i = n; i < 1000; ++i) {
var phraseID = suffix + i;
if (!getPhraseByPhraseID(phraseID)) return phraseID;
}
}
// ========================================================
// Set up editor for replies
function buildEditorForReply(div, reply, tree, treeNode) {
var dialogueReply = $( "#dialogueReply", div );
checkboxHidesElement( $( '#requiresItems', dialogueReply ), $( '#requiresItemsDisplay', dialogueReply ), reply.requires_itemID);
checkboxHidesElement( $( '#requiresQuest', dialogueReply ), $( '#requiresQuestDisplay', dialogueReply ), reply.requires_Progress);
bindFieldToDataStore( $( "#requires_itemID", dialogueReply ), model.items , function(obj) { return obj.searchTag; } );
bindFieldToDataStore( $( "#requires_Progress", dialogueReply ), model.quests , function(obj) { return obj.id; } );
var replyLeadsTo = $( "#replyLeadsTo", dialogueReply );
replyLeadsTo.change(function() { nextPhraseID.val( $(this).val() ).change(); });
replyLeadsTo.val(reply.nextPhraseID);
changeHidesElement(replyLeadsTo, $( "#nextPhraseIDDisplay", dialogueReply ) , function() { return replyLeadsTo.val() == ''; } );
var nextPhraseID = $( "#nextPhraseID", dialogueReply );
nextPhraseID.change(function() {
updatePhraseTreeNodesBelow(tree, treeNode, getPhraseByPhraseID(reply.nextPhraseID) );
});
$( "#followReply", dialogueReply ).button().unbind('click').click(function() {
openNextPhrase(nextPhraseID.val(), div, reply, tree);
});
$( '#text', dialogueReply ).change(function() { treeNode.setTitle( getReplyNodeText(reply) ); });
dialogueReply.show();
}
// ========================================================
// Tree node key generators
function getTreeNodeKey(obj) {
if (!obj) return "";
if (obj.isPhrase) return obj.id;
return getTreeNodeReplyKey(obj);
}
function getTreeNodeReplyKey(obj) {
var idx = 0;
for (var i = 0; i < obj.phrase.replies.length; ++i) {
if (obj.phrase.replies[i] == obj) {
idx = i;
break;
}
}
return getTreeNodeReplyKeyIndex(obj, idx);
}
function getTreeNodeReplyKeyIndex(obj, idx) {
return getTreeNodeKey(obj.phrase) + "__reply_" + idx;
}
// ========================================================
// Tree node title generators
function getPhraseNodeText(phrase) {
return phrase.message ? phrase.message : "(no phrase text)";
}
function getReplyNodeText(reply) {
return reply.text ? reply.text : "(no reply text)";
}
// ========================================================
// Tree-building functions
// (re)Build a NPC phrase node
function updatePhraseTreeNodesBelow(tree, parent, phrase, keepExisting) {
if (!keepExisting) { parent.removeChildren(); }
if (!phrase) return;
phrase.isPhrase = true;
var key = getTreeNodeKey(phrase);
if (tree.getNodeByKey(key)) {
parent.addChild({
title: '(conversation loop)'
,model: phrase
});
return;
}
var phraseNode = parent.addChild({
title: getPhraseNodeText(phrase)
,key: key
,model: phrase
,icon: 'phrase.png'
});
if (!phrase.replies) phrase.replies = [];
updatePhraseReplyTreeNodesBelow(tree, phraseNode, phrase, phrase.replies);
phraseNode.expand(true);
return phraseNode;
}
// (re)Build all nodes below a NPC phrase (i.e. rebuild all reply nodes)
function updatePhraseReplyTreeNodesBelow(tree, phraseNode, phrase) {
phraseNode.removeChildren();
if (!phrase.replies) phrase.replies = [];
if (phrase.replies.length == 1) {
var singleReply = phrase.replies[0];
if (singleReply.text == 'N') {
phrase.hasOnlyNextReply = true;
updatePhraseTreeNodesBelow(tree, phraseNode, getPhraseByPhraseID(singleReply.nextPhraseID) );
return;
}
}
phrase.replies.forEach(function(reply, idx) {
jQuery.extend(reply, createReplyForPhrase(phrase));
var key = getTreeNodeReplyKeyIndex(reply, idx);
var replyNode = phraseNode.addChild({
title: getReplyNodeText(reply)
,key: key
,model: reply
,icon: 'reply.png'
});
if (reply.nextPhraseID) {
updatePhraseTreeNodesBelow(tree, replyNode, getPhraseByPhraseID(reply.nextPhraseID) );
}
replyNode.expand(true);
});
}

View File

@@ -0,0 +1,18 @@
function createDroplistEditor(obj) {
var div = $( "#templates #editDroplist" ).clone(true);
applyCommonEditorBindings(div, obj, model.droplists);
if (!obj.items) obj.items = [];
applyTableEditor({
table: $( "#items", div ),
dialog: droplistItemDialog,
array: obj.items,
templateFunction: function() { return { quantity: 1, chance: 100 } },
editorSetup: function(div) {
bindFieldToDataStore( $( "#itemID", div ), model.items , function(obj) { return obj.searchTag; } );
}
});
return div;
}

View File

@@ -0,0 +1,60 @@
function createItemEditor(obj) {
var div = $( "#templates #editItem" ).clone();
applyCommonEditorBindings(div, obj, model.items);
checkboxHidesElement(div.find('#hasEquipEffect'), div.find('#hasEquipEffectDisplay'), obj.hasEquipEffect);
checkboxHidesElement(div.find('#hasUseEffect'), div.find('#hasUseEffectDisplay'), obj.hasUseEffect);
checkboxHidesElement(div.find('#equip_hasCritical'), div.find('#equip_hasCriticalDisplay'), obj.equip_criticalChance || obj.equip_criticalMultiplier);
checkboxHidesElement(div.find('#hasHitEffect'), div.find('#hasHitEffectDisplay'), obj.hasHitEffect);
checkboxHidesElement(div.find('#hasKillEffect'), div.find('#hasKillEffectDisplay'), obj.hasKillEffect);
imageSelector.imageify(div.find('#itemimage'), div.find('#iconID'), 'items');
var createNewCondition = function() { return { chance: 100, magnitude: 1 }; }
if (!obj.equip_conditions) obj.equip_conditions = [];
if (!obj.use_conditionsSource) obj.use_conditionsSource = [];
if (!obj.hit_conditionsSource) obj.hit_conditionsSource = [];
if (!obj.hit_conditionsTarget) obj.hit_conditionsTarget = [];
if (!obj.kill_conditionsSource) obj.kill_conditionsSource = [];
var setupEditor = function(div) {
bindFieldToDataStore( $( "#condition", div ), model.actorConditions , function(obj) { return obj.id; } );
}
applyTableEditor({
table: $( "#equip_conditions", div ),
dialog: equipConditionsDialog,
array: obj.equip_conditions,
templateFunction: createNewCondition,
editorSetup: setupEditor
});
applyTableEditor({
table: $( "#use_conditionsSource", div ),
dialog: onHitConditionsDialog,
array: obj.use_conditionsSource,
templateFunction: createNewCondition,
editorSetup: setupEditor
});
applyTableEditor({
table: $( "#hit_conditionsSource", div ),
dialog: onHitConditionsDialog,
array: obj.hit_conditionsSource,
templateFunction: createNewCondition,
editorSetup: setupEditor
});
applyTableEditor({
table: $( "#hit_conditionsTarget", div ),
dialog: onHitConditionsDialog,
array: obj.hit_conditionsTarget,
templateFunction: createNewCondition,
editorSetup: setupEditor
});
applyTableEditor({
table: $( "#kill_conditionsSource", div ),
dialog: onHitConditionsDialog,
array: obj.kill_conditionsSource,
templateFunction: createNewCondition,
editorSetup: setupEditor
});
return div;
}

View File

@@ -0,0 +1,34 @@
function createMonsterEditor(obj) {
var div = $( "#templates #editMonster" ).clone();
applyCommonEditorBindings(div, obj, model.monsters);
checkboxHidesElement(div.find('#hasConversation'), div.find('#hasConversationDisplay'), obj.phraseID);
checkboxHidesElement(div.find('#hasCombat'), div.find('#hasCombatDisplay'), obj.attackChance);
checkboxHidesElement(div.find('#hasCritical'), div.find('#hasCriticalDisplay'), obj.criticalChance || obj.criticalMultiplier);
checkboxHidesElement(div.find('#hasHitEffect'), div.find('#hasHitEffectDisplay'), obj.hasHitEffect);
imageSelector.imageify(div.find('#monsterimage'), div.find('#iconID'), 'monsters');
bindFieldToDataStore( $( "#droplistID", div ), model.droplists , function(obj) { return obj.id; } );
var createNewCondition = function() { return { chance: 100, magnitude: 1 }; }
if (!obj.onHit_conditionsSource) obj.onHit_conditionsSource = [];
if (!obj.onHit_conditionsTarget) obj.onHit_conditionsTarget = [];
var setupEditor = function(div) {
bindFieldToDataStore( $( "#condition", div ), model.actorConditions , function(obj) { return obj.id; } );
}
applyTableEditor({
table: $( "#onHit_conditionsSource", div ),
dialog: onHitConditionsDialog,
array: obj.onHit_conditionsSource,
templateFunction: createNewCondition,
editorSetup: setupEditor
});
applyTableEditor({
table: $( "#onHit_conditionsTarget", div ),
dialog: onHitConditionsDialog,
array: obj.onHit_conditionsTarget,
templateFunction: createNewCondition,
editorSetup: setupEditor
});
return div;
}

View File

@@ -0,0 +1,21 @@
function createQuestEditor(obj) {
var div = $( "#templates #editQuest" ).clone(true);
applyCommonEditorBindings(div, obj, model.quests);
if (!obj.stages) obj.stages = [];
var array = obj.stages;
var createNewStage = function() {
var nextProgress;
if (array.length > 0) { nextProgress = parseInt(array[array.length - 1].progress) + 10; }
if (!nextProgress) { nextProgress = 10; }
return { progress: nextProgress };
};
applyTableEditor({
table: $( "#stages", div ),
dialog: questlogDialog,
array: array,
templateFunction: createNewStage
});
return div;
}

View File

@@ -0,0 +1,55 @@
function exportIfExists(dataStore, div) {
var exists = false;
if (dataStore && dataStore.items.length > 0) exists = true;
div.toggle(exists);
if (!exists) { return; }
var exportData = dataStore.serialize();
$( "#value" , div ).val(exportData);
}
function importDatastore(dataStore, content) {
dataStore.deserialize(content);
}
function prepareImport(dataStore, div) {
var importButton = $( "#import", div );
var textarea = $( "#value", div );
importButton.button({ disabled: true }).click(function() {
if (!textarea.val()) return;
importDatastore(dataStore, textarea.val());
div.hide('slow');
});
textarea.val("").change(function() {
var disabled = $(this).val() ? false : true;
importButton.button( "option", "disabled", disabled );
});
}
var importExportDialog;
function showImportDialog() {
importExportDialog.dialog({ title: "Import data" });
$( "div", importExportDialog ).show();
prepareImport(model.actorConditions, $( "#actorconditions", importExportDialog ));
prepareImport(model.quests, $( "#quests", importExportDialog ));
prepareImport(model.items, $( "#items", importExportDialog ));
prepareImport(model.droplists, $( "#droplists", importExportDialog ));
prepareImport(model.dialogue, $( "#dialogue", importExportDialog ));
prepareImport(model.monsters, $( "#monsters", importExportDialog ));
importExportDialog.dialog( "open" );
}
function showExportDialog() {
importExportDialog.dialog({ title: "Export data" });
exportIfExists(model.actorConditions, $( "#actorconditions", importExportDialog ));
exportIfExists(model.quests, $( "#quests", importExportDialog ));
exportIfExists(model.items, $( "#items", importExportDialog ));
exportIfExists(model.droplists, $( "#droplists", importExportDialog ));
exportIfExists(model.dialogue, $( "#dialogue", importExportDialog ));
exportIfExists(model.monsters, $( "#monsters", importExportDialog ));
$( "#import", importExportDialog ).hide();
importExportDialog.dialog( "open" );
}

View File

@@ -1 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

View File

@@ -1,46 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<link href="styles.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="editor.js"></script>
<title>Droplist Editor</title>
<script type="text/javascript">
var imagepath = "../AndorsTrail/res/drawable/";
var tileimages = [];
var fields = [
{ name: "Droplist", type: "text" }
, { name: "ItemTag", type: "text" }
, { name: "Frequency", type: "select", values: [ "Always:100", "Often:70", "Animalpart:30", "Seldom:25", "VerySeldom:5", "Unique:1" ]}
, { name: "Quantity", type: "range" }
];
</script>
</head>
<body>
<div id="editarea">
Items:<br />
<div id="inputarea">
<table id="datatable" cellspacing="0">
<thead>
<tr id="headerrow"> </tr>
</thead>
<tbody id="datarows">
</tbody>
</table>
</div>
<div id="buttons"> </div>
</div>
<br />
<div id="output">
<textarea id="result" cols="80" rows="10">serialized output goes here</textarea>
</div>
<div id="invisible"></div>
<div id="selecticon_dialog" title="Select image">
<div id="selecticon_dialog_tileset"> </div>
</div>
</body>
</html>

View File

@@ -1,57 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<link href="styles.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="editor.js"></script>
<title>Item Editor</title>
<script type="text/javascript">
var imagepath = "../AndorsTrail/res/drawable/";
var tileimages = [
{ name: "items_tiles", numtilesx: "14", numtilesy: "30" }
];
var fields = [
{ name: "Tag", type: "text" }
, { name: "Icon", type: "image" }
, { name: "Name", type: "longtext" }
, { name: "Category", type: "select", values: [ "WEAPON:0", "SHIELD:1", "WEARABLE_HEAD:2", "WEARABLE_BODY:3", "WEARABLE_HAND:4", "WEARABLE_FEET:5", "WEARABLE_NECK:6", "WEARABLE_RING:7", "POTION:20", "FOOD:21", "MONEY:30", "OTHER:31" ]}
, { name: "Cost", type: "int" }
, { name: "HP", type: "range" }
, { name: "AtkCost", type: "int" }
, { name: "AtkPct", type: "int" }
, { name: "CritPct", type: "int" }
, { name: "CritMult", type: "int" }
, { name: "DMG", type: "range" }
, { name: "BlkPct", type: "int" }
, { name: "DMG_res", type: "int" }
];
</script>
</head>
<body>
<div id="editarea">
Items:<br />
<div id="inputarea">
<table id="datatable" cellspacing="0">
<thead>
<tr id="headerrow"> </tr>
</thead>
<tbody id="datarows">
</tbody>
</table>
</div>
<div id="buttons"> </div>
</div>
<br />
<div id="output">
<textarea id="result" cols="80" rows="10">serialized output goes here</textarea>
</div>
<div id="invisible"></div>
<div id="selecticon_dialog" title="Select image">
<div id="selecticon_dialog_tileset"> </div>
</div>
</body>
</html>

View File

@@ -1,93 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<link href="styles.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="editor.js"></script>
<title>Monster Editor</title>
<script type="text/javascript">
var imagepath = "../AndorsTrail/res/drawable/";
var tileimages = [
{ name: "monsters_armor1", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_demon1", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_demon2", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_dogs", numtilesx: "7", numtilesy: "1" }
,{ name: "monsters_dragons", numtilesx: "7", numtilesy: "1" }
,{ name: "monsters_eye1", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_eye2", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_eye3", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_eye4", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_ghost1", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_ghost2", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_hydra1", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_insects", numtilesx: "6", numtilesy: "1" }
,{ name: "monsters_liches", numtilesx: "4", numtilesy: "1" }
,{ name: "monsters_mage", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_mage2", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_mage3", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_mage4", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_man1", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_men", numtilesx: "9", numtilesy: "1" }
,{ name: "monsters_men2", numtilesx: "10", numtilesy: "1" }
,{ name: "monsters_misc", numtilesx: "12", numtilesy: "1" }
,{ name: "monsters_rats", numtilesx: "5", numtilesy: "1" }
,{ name: "monsters_rogue1", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_skeleton1", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_skeleton2", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_snakes", numtilesx: "6", numtilesy: "1" }
,{ name: "monsters_cyclops", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_warrior1", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_wraiths", numtilesx: "3", numtilesy: "1" }
,{ name: "monsters_zombie1", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_zombie2", numtilesx: "1", numtilesy: "1" }
,{ name: "monsters_dragon1", numtilesx: "1", numtilesy: "1" }
];
var fields = [
{ name: "Icon", type: "image" }
, { name: "Name", type: "longtext" }
, { name: "Tags", type: "text" }
, { name: "Size", type: "size", default: "1x1" }
, { name: "Exp", type: "int" }
, { name: "HP_max", type: "int" }
, { name: "AP_max", type: "int" }
, { name: "AP_move", type: "int" }
, { name: "AtkCost", type: "int" }
, { name: "AtkPct", type: "int" }
, { name: "CritPct", type: "int" }
, { name: "CritMult", type: "int" }
, { name: "DMG", type: "range" }
, { name: "BlkPct", type: "int" }
, { name: "DMG_res", type: "int" }
, { name: "Drop", type: "text" }
, { name: "Phrase", type: "text" }
];
</script>
</head>
<body>
<div id="editarea">
Monsters:<br />
<div id="inputarea">
<table id="datatable" cellspacing="0">
<thead>
<tr id="headerrow"> </tr>
</thead>
<tbody id="datarows">
</tbody>
</table>
</div>
<div id="buttons"> </div>
</div>
<br />
<div id="output">
<textarea id="result" cols="80" rows="10">serialized output goes here</textarea>
</div>
<div id="invisible"></div>
<div id="selecticon_dialog" title="Select image">
<div id="selecticon_dialog_tileset"> </div>
</div>
</body>
</html>

View File

@@ -6,7 +6,9 @@
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="styles2.css" />
<link rel="stylesheet" type="text/css" href="inc/ui.dynatree.css" />
<script type="text/javascript" src="AndorsTrailEditor.js"></script>
<title>Andor's Trail Content Editor</title>
</head>
@@ -17,7 +19,7 @@
<div class="andorsTrailLogo" id="title">
Andor's Trail Content Editor
<span id="version">
v0.6.9dev1
v0.6.9a0
</span>
</div>
<div id="buttons">
@@ -28,8 +30,8 @@
<div id="left" class="workarea">
<div id="tools">
<h3><a href="#">Actor status effects</a></h3>
<div id="effectlist">
<h3><a href="#">Actor conditions</a></h3>
<div id="actorconditionlist">
<ul class="itemlist"> </ul>
<div id="add">Add</div>
</div>
@@ -54,11 +56,7 @@
<h3><a href="#">Dialogue</a></h3>
<div id="conversationlist">
<ul class="itemlist">
<li>TODO: Conversation 1</li>
<li>TODO: Conversation 2</li>
<li>TODO: Conversation 3</li>
</ul>
<ul class="itemlist"> </ul>
<div id="add">Add</div>
</div>
@@ -226,7 +224,7 @@
<div id="dialog-onHitConditions">
<div class="fieldWithLabel">
<label for="condition" class="label">Actor status effect id:</label>
<label for="condition" class="label">Actor condition id:</label>
<input type="text" size="30" id="condition" class="field fieldInput"/>
</div>
<div class="fieldWithLabel">
@@ -409,7 +407,7 @@
<input class="field" type="text" size="5" id="equip_damageResistance" class="fieldInput integer" />
</div>
<div class="fieldWithLabel">
<label for="equip_conditions" class="label">Apply status effects</label>
<label for="equip_conditions" class="label">Apply actor condition</label>
<table class="field" id="equip_conditions">
<thead><tr>
<th id="condition">Condition</th>
@@ -432,7 +430,7 @@
<div class="field"><input type="text" size="3" id="use_boostAP_Min" class="fieldInput" /> - <input type="text" size="3" id="use_boostAP_Max" class="fieldInput integer" /></div>
</div>
<div class="fieldWithLabel">
<label for="use_conditionsSource" class="label">Apply status effects</label>
<label for="use_conditionsSource" class="label">Apply actor condition</label>
<table class="field" id="use_conditionsSource">
<thead><tr>
<th id="condition">Condition</th>
@@ -457,7 +455,7 @@
<div class="field"><input type="text" size="3" id="hit_boostAP_Min" class="fieldInput" /> - <input type="text" size="3" id="hit_boostAP_Max" class="fieldInput integer" /></div>
</div>
<div class="fieldWithLabel">
<label for="hit_conditionsSource" class="label">Apply status effects to source</label>
<label for="hit_conditionsSource" class="label">Apply actor condition to source</label>
<table class="field" id="hit_conditionsSource">
<thead><tr>
<th id="condition">Condition</th>
@@ -471,7 +469,7 @@
<div id="add">Add</div>
</div>
<div class="fieldWithLabel">
<label for="hit_conditionsTarget" class="label">Apply status effects to target</label>
<label for="hit_conditionsTarget" class="label">Apply actor condition to target</label>
<table class="field" id="hit_conditionsTarget">
<thead><tr>
<th id="condition">Condition</th>
@@ -496,7 +494,7 @@
<div class="field"><input type="text" size="3" id="kill_boostAP_Min" class="fieldInput" /> - <input type="text" size="3" id="kill_boostAP_Max" class="fieldInput integer" /></div>
</div>
<div class="fieldWithLabel">
<label for="kill_conditionsSource" class="label">Apply status effects</label>
<label for="kill_conditionsSource" class="label">Apply actor condition</label>
<table class="field" id="kill_conditionsSource">
<thead><tr>
<th id="condition">Condition</th>
@@ -515,7 +513,7 @@
<div id="dialog-equipConditions">
<div class="fieldWithLabel">
<label for="condition" class="label">Actor status effect id:</label>
<label for="condition" class="label">Actor condition id:</label>
<input type="text" size="30" id="condition" class="field fieldInput"/>
</div>
<div class="fieldWithLabel">
@@ -582,18 +580,131 @@
<div class="label"><input type="checkbox" id="finishesQuest" />Finishes quest</div>
</div>
</div>
<!-- ========================================================= -->
<!-- Dialogue editor -->
<div id="editDialogue">
<h3>Dialogue</h3>
<fieldset class="fieldSet">
<legend>Conversation flow</legend>
<div id="dialogueTree"> </div>
</fieldset>
<fieldset class="fieldSet" id="dialoguePhrase">
<legend>NPC phrase</legend>
<div class="fieldWithLabel">
<label for="id" class="label">Phrase ID:</label>
<input type="text" size="30" id="id" class="field fieldInput"/>
</div>
<div class="fieldWithLabel">
<label for="message" class="label">NPC says:</label>
<textarea rows="4" cols="40" id="message"></textarea>
</div>
<div class="fieldWithLabel">
<div class="label"><input type="checkbox" id="hasProgressQuest" />Reaching this phrase progresses quest</div>
</div>
<div class="fieldWithLabel" id="hasProgressQuestDisplay">
<label for="progressQuest" class="label">Progress to quest stage: (questname:stage)</label>
<input type="text" size="30" id="progressQuest" class="field fieldInput" title="For example, 'mikhail:20' would advance the quest mikhail to stage 20."/>
</div>
<div class="fieldWithLabel">
<div class="label"><input type="checkbox" id="hasRewardDroplist" />Reaching this phrase gives items</div>
</div>
<div class="fieldWithLabel" id="hasRewardDroplistDisplay">
<label for="rewardDropListID" class="label">Droplist ID of items to give</label>
<input type="text" size="30" id="rewardDropListID" class="field fieldInput"/>
</div>
</fieldset>
<fieldset class="fieldSet" id="dialoguePhraseReplies">
<legend>Replies</legend>
<div class="fieldWithLabel">
<div class="label"><input type="checkbox" id="hasOnlyNextReply" />Phrase leads directly to another phrase without replies</div>
</div>
<div class="fieldWithLabel" id="hasOnlyNextReplyDisplay">
<label for="nextPhraseID" class="label">Phrase ID:</label>
<div class="field">
<input type="text" size="30" id="nextPhraseID" class="fieldInput" />
<img src="imgarrowright.png" alt="Follow" id="followNextReply" class="imageButton" />
</div>
</div>
<div class="fieldWithLabel" id="hasRepliesDisplay">
<label for="replies" class="label">Replies</label>
<table class="field" id="replies">
<thead><tr>
<th id="text">Reply</th>
</tr></thead>
<tbody>
</tbody>
</table>
<div id="add">Add</div>
</div>
</fieldset>
<fieldset class="fieldSet" id="dialogueReply">
<legend>Player reply</legend>
<div class="fieldWithLabel">
<label for="id" class="label">Phrase ID:</label>
<input type="text" size="30" id="id" class="field fieldInput" readonly="readonly" />
</div>
<div class="fieldWithLabel">
<label for="text" class="label">Player says:</label>
<textarea rows="4" cols="40" id="text"></textarea>
</div>
<div class="fieldWithLabel">
<label for="replyLeadsTo" class="label">Reply leads to:</label>
<select class="field fieldInput" id="replyLeadsTo">
<option value="">NPC phrase</option>
<option value="S">Trading screen</option>
<option value="F">Combat</option>
<option value="X">Conversation ends</option>
<option value="R">NPC is removed from map</option>
</select>
</div>
<div class="fieldWithLabel" id="nextPhraseIDDisplay">
<label for="nextPhraseID" class="label">Next phrase ID:</label>
<div class="field">
<input type="text" size="30" id="nextPhraseID" class="fieldInput"/>
<img src="imgarrowright.png" alt="Follow" id="followReply" class="imageButton" />
</div>
</div>
<div class="fieldWithLabel">
<div class="label"><input type="checkbox" id="requiresItems" />Player must have item(s) to select this reply</div>
</div>
<div id="requiresItemsDisplay">
<div class="fieldWithLabel">
<label for="requires_itemID" class="label">Required item ID (will be removed from inventory)</label>
<input type="text" size="30" id="requires_itemID" class="field fieldInput"/>
</div>
<div class="fieldWithLabel">
<label for="requires_Quantity" class="label">Required item quantity</label>
<input type="text" size="5" id="requires_Quantity" class="field fieldInput integer"/>
</div>
</div>
<div class="fieldWithLabel">
<div class="label"><input type="checkbox" id="requiresQuest" />Player must have progressed quest to select this reply</div>
</div>
<div class="fieldWithLabel" id="requiresQuestDisplay">
<label for="requires_Progress" class="label">Quest stage required: (questname:stage)</label>
<input type="text" size="30" id="requires_Progress" class="field fieldInput" title="For example, 'mikhail:20' would require that the quest mikhail is at at least stage 20."/>
</div>
</fieldset>
<div class="endSets"> </div>
</div>
<!-- ========================================================= -->
<!-- Actor effects editor -->
<!-- Actor condition editor -->
<div id="editActorEffect">
<h3>Actor status effect</h3>
<div id="editActorCondition">
<h3>Actor condition</h3>
<fieldset class="fieldSet">
<legend>General</legend>
<div class="fieldWithLabel">
<div id="statuseffectimage" class="field"><input type="hidden" id="iconID" /></div>
<div id="actorconditionimage" class="field"><input type="hidden" id="iconID" /></div>
</div>
<div class="fieldWithLabel">
<label for="id" class="label">Internal ID:</label>
@@ -712,9 +823,9 @@
<!-- Import / Export dialog form -->
<div id="dialog-importexport">
<div id="statuseffects">
<div class="importexport-header">Actor status effects</div>
<div id="description">This data corresponds to res/values/actorstatuseffects.xml in the source code.</div>
<div id="actorconditions">
<div class="importexport-header">Actor conditions</div>
<div id="description">This data corresponds to res/values/actorconditions.xml in the source code.</div>
<textarea id="value" rows="6" cols="80"></textarea>
<div id="import">Import</div>
</div>

View File

@@ -1,47 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<link href="styles.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="editor.js"></script>
<title>Quest Log Editor</title>
<script type="text/javascript">
var imagepath = "../AndorsTrail/res/drawable/";
var tileimages = [];
var fields = [
{ name: "QuestID", type: "longtext" }
, { name: "Progress", type: "int" }
, { name: "LogText", type: "multiline" }
, { name: "RewardExp", type: "int" }
, { name: "ResolvesQuest", type: "select", values: [ "No:0", "Yes:1" ]}
];
</script>
</head>
<body>
<div id="editarea">
Items:<br />
<div id="inputarea">
<table id="datatable" cellspacing="0">
<thead>
<tr id="headerrow"> </tr>
</thead>
<tbody id="datarows">
</tbody>
</table>
</div>
<div id="buttons"> </div>
</div>
<br />
<div id="output">
<textarea id="result" cols="80" rows="10">serialized output goes here</textarea>
</div>
<div id="invisible"></div>
<div id="selecticon_dialog" title="Select image">
<div id="selecticon_dialog_tileset"> </div>
</div>
</body>
</html>

View File

@@ -1,46 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<link href="styles.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="editor.js"></script>
<title>Quest Editor</title>
<script type="text/javascript">
var imagepath = "../AndorsTrail/res/drawable/";
var tileimages = [];
var fields = [
{ name: "ID", type: "text" }
, { name: "Name", type: "longtext" }
, { name: "DisplayText", type: "multiline" }
, { name: "ShowInLog", type: "select", values: [ "Yes:1", "No:0" ]}
];
</script>
</head>
<body>
<div id="editarea">
Items:<br />
<div id="inputarea">
<table id="datatable" cellspacing="0">
<thead>
<tr id="headerrow"> </tr>
</thead>
<tbody id="datarows">
</tbody>
</table>
</div>
<div id="buttons"> </div>
</div>
<br />
<div id="output">
<textarea id="result" cols="80" rows="10">serialized output goes here</textarea>
</div>
<div id="invisible"></div>
<div id="selecticon_dialog" title="Select image">
<div id="selecticon_dialog_tileset"> </div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -0,0 +1,252 @@
// jquery.dynatree.js build 1.1.1
// Revision: 481, date: 2011-03-02 07:25:35
// Copyright (c) 2008-10 Martin Wendt (http://dynatree.googlecode.com/)
// Dual licensed under the MIT or GPL Version 2 licenses.
var _canLog=true;function _log(mode,msg){if(!_canLog){return;}
var args=Array.prototype.slice.apply(arguments,[1]);var dt=new Date();var tag=dt.getHours()+":"+dt.getMinutes()+":"+dt.getSeconds()+"."+dt.getMilliseconds();args[0]=tag+" - "+args[0];try{switch(mode){case"info":window.console.info.apply(window.console,args);break;case"warn":window.console.warn.apply(window.console,args);break;default:window.console.log.apply(window.console,args);break;}}catch(e){if(!window.console){_canLog=false;}}}
function logMsg(msg){Array.prototype.unshift.apply(arguments,["debug"]);_log.apply(this,arguments);}
var getDynaTreePersistData=null;var DTNodeStatus_Error=-1;var DTNodeStatus_Loading=1;var DTNodeStatus_Ok=0;(function($){var Class={create:function(){return function(){this.initialize.apply(this,arguments);};}};function getDtNodeFromElement(el){var iMax=5;while(el&&iMax--){if(el.dtnode){return el.dtnode;}
el=el.parentNode;}
return null;}
function noop(){}
var DynaTreeNode=Class.create();DynaTreeNode.prototype={initialize:function(parent,tree,data){this.parent=parent;this.tree=tree;if(typeof data==="string"){data={title:data};}
if(data.key===undefined){data.key="_"+tree._nodeCount++;}
this.data=$.extend({},$.ui.dynatree.nodedatadefaults,data);this.li=null;this.span=null;this.ul=null;this.childList=null;this.isLoading=false;this.hasSubSel=false;this.bExpanded=false;this.bSelected=false;},toString:function(){return"DynaTreeNode<"+this.data.key+">: '"+this.data.title+"'";},toDict:function(recursive,callback){var dict=$.extend({},this.data);dict.activate=(this.tree.activeNode===this);dict.focus=(this.tree.focusNode===this);dict.expand=this.bExpanded;dict.select=this.bSelected;if(callback){callback(dict);}
if(recursive&&this.childList){dict.children=[];for(var i=0,l=this.childList.length;i<l;i++){dict.children.push(this.childList[i].toDict(true,callback));}}else{delete dict.children;}
return dict;},fromDict:function(dict){var children=dict.children;if(children===undefined){this.data=$.extend(this.data,dict);this.render();return;}
dict=$.extend({},dict);dict.children=undefined;this.data=$.extend(this.data,dict);this.removeChildren();this.addChild(children);},_getInnerHtml:function(){var tree=this.tree,opts=tree.options,cache=tree.cache,level=this.getLevel(),data=this.data,res="";if(level<opts.minExpandLevel){if(level>1){res+=cache.tagConnector;}}else if(this.hasChildren()!==false){res+=cache.tagExpander;}else{res+=cache.tagConnector;}
if(opts.checkbox&&data.hideCheckbox!==true&&!data.isStatusNode){res+=cache.tagCheckbox;}
if(data.icon){res+="<img src='"+opts.imagePath+data.icon+"' alt='' />";}else if(data.icon===false){noop();}else{res+=cache.tagNodeIcon;}
var nodeTitle="";if(opts.onCustomRender){nodeTitle=opts.onCustomRender.call(tree,this)||"";}
if(!nodeTitle){var tooltip=data.tooltip?" title='"+data.tooltip+"'":"";if(opts.noLink||data.noLink){nodeTitle="<span style='display: inline-block;' class='"+opts.classNames.title+"'"+tooltip+">"+data.title+"</span>";}else{nodeTitle="<a href='#' class='"+opts.classNames.title+"'"+tooltip+">"+data.title+"</a>";}}
res+=nodeTitle;return res;},_fixOrder:function(){var cl=this.childList;if(!cl||!this.ul){return;}
var childLI=this.ul.firstChild;for(var i=0,l=cl.length-1;i<l;i++){var childNode1=cl[i];var childNode2=childLI.dtnode;if(childNode1!==childNode2){this.tree.logDebug("_fixOrder: mismatch at index "+i+": "+childNode1+" != "+childNode2);this.ul.insertBefore(childNode1.li,childNode2.li);}else{childLI=childLI.nextSibling;}}},render:function(useEffects,includeInvisible){var tree=this.tree,parent=this.parent,data=this.data,opts=tree.options,cn=opts.classNames,isLastSib=this.isLastSibling();if(!parent&&!this.ul){this.li=this.span=null;this.ul=document.createElement("ul");if(opts.minExpandLevel>1){this.ul.className=cn.container+" "+cn.noConnector;}else{this.ul.className=cn.container;}}else if(parent){if(!this.li){this.li=document.createElement("li");this.li.dtnode=this;if(data.key&&opts.generateIds){this.li.id=opts.idPrefix+data.key;}
this.span=document.createElement("span");this.span.className=cn.title;this.li.appendChild(this.span);if(!parent.ul){parent.ul=document.createElement("ul");parent.ul.style.display="none";parent.li.appendChild(parent.ul);}
parent.ul.appendChild(this.li);}
this.span.innerHTML=this._getInnerHtml();var cnList=[];cnList.push(cn.node);if(data.isFolder){cnList.push(cn.folder);}
if(this.bExpanded){cnList.push(cn.expanded);}
if(this.hasChildren()!==false){cnList.push(cn.hasChildren);}
if(data.isLazy&&this.childList===null){cnList.push(cn.lazy);}
if(isLastSib){cnList.push(cn.lastsib);}
if(this.bSelected){cnList.push(cn.selected);}
if(this.hasSubSel){cnList.push(cn.partsel);}
if(tree.activeNode===this){cnList.push(cn.active);}
if(data.addClass){cnList.push(data.addClass);}
cnList.push(cn.combinedExpanderPrefix
+(this.bExpanded?"e":"c")
+(data.isLazy&&this.childList===null?"d":"")
+(isLastSib?"l":""));cnList.push(cn.combinedIconPrefix
+(this.bExpanded?"e":"c")
+(data.isFolder?"f":""));this.span.className=cnList.join(" ");this.li.className=isLastSib?cn.lastsib:"";if(opts.onRender){opts.onRender.call(tree,this,this.span);}}
if((this.bExpanded||includeInvisible===true)&&this.childList){for(var i=0,l=this.childList.length;i<l;i++){this.childList[i].render(false,includeInvisible);}
this._fixOrder();}
if(this.ul){var isHidden=(this.ul.style.display==="none");var isExpanded=!!this.bExpanded;if(useEffects&&opts.fx&&(isHidden===isExpanded)){var duration=opts.fx.duration||200;$(this.ul).animate(opts.fx,duration);}else{this.ul.style.display=(this.bExpanded||!parent)?"":"none";}}},getKeyPath:function(excludeSelf){var path=[];this.visitParents(function(node){if(node.parent){path.unshift(node.data.key);}},!excludeSelf);return"/"+path.join(this.tree.options.keyPathSeparator);},getParent:function(){return this.parent;},getChildren:function(){return this.childList;},hasChildren:function(){if(this.data.isLazy){if(this.childList===null||this.childList===undefined){return undefined;}else if(this.childList.length===0){return false;}else if(this.childList.length===1&&this.childList[0].isStatusNode()){return undefined;}
return true;}
return!!this.childList;},isFirstSibling:function(){var p=this.parent;return!p||p.childList[0]===this;},isLastSibling:function(){var p=this.parent;return!p||p.childList[p.childList.length-1]===this;},getPrevSibling:function(){if(!this.parent){return null;}
var ac=this.parent.childList;for(var i=1,l=ac.length;i<l;i++){if(ac[i]===this){return ac[i-1];}}
return null;},getNextSibling:function(){if(!this.parent){return null;}
var ac=this.parent.childList;for(var i=0,l=ac.length-1;i<l;i++){if(ac[i]===this){return ac[i+1];}}
return null;},isStatusNode:function(){return(this.data.isStatusNode===true);},isChildOf:function(otherNode){return(this.parent&&this.parent===otherNode);},isDescendantOf:function(otherNode){if(!otherNode){return false;}
var p=this.parent;while(p){if(p===otherNode){return true;}
p=p.parent;}
return false;},countChildren:function(){var cl=this.childList;if(!cl){return 0;}
var n=cl.length;for(var i=0,l=n;i<l;i++){var child=cl[i];n+=child.countChildren();}
return n;},sortChildren:function(cmp,deep){var cl=this.childList;if(!cl){return;}
cmp=cmp||function(a,b){return a.data.title===b.data.title?0:a.data.title>b.data.title?1:-1;};cl.sort(cmp);if(deep){for(var i=0,l=cl.length;i<l;i++){if(cl[i].childList){cl[i].sortChildren(cmp,"$norender$");}}}
if(deep!=="$norender$"){this.render();}},_setStatusNode:function(data){var firstChild=(this.childList?this.childList[0]:null);if(!data){if(firstChild&&firstChild.isStatusNode()){try{if(this.ul){this.ul.removeChild(firstChild.li);}}catch(e){}
if(this.childList.length===1){this.childList=[];}else{this.childList.shift();}}}else if(firstChild){data.isStatusNode=true;data.key="_statusNode";firstChild.data=data;firstChild.render();}else{data.isStatusNode=true;data.key="_statusNode";firstChild=this.addChild(data);}},setLazyNodeStatus:function(lts,opts){var tooltip=(opts&&opts.tooltip)?opts.tooltip:null;var info=(opts&&opts.info)?" ("+opts.info+")":"";switch(lts){case DTNodeStatus_Ok:this._setStatusNode(null);$(this.span).removeClass(this.tree.options.classNames.nodeLoading);this.isLoading=false;if(this.tree.options.autoFocus){if(this===this.tree.tnRoot&&this.childList&&this.childList.length>0){this.childList[0].focus();}else{this.focus();}}
break;case DTNodeStatus_Loading:this.isLoading=true;$(this.span).addClass(this.tree.options.classNames.nodeLoading);if(!this.parent){this._setStatusNode({title:this.tree.options.strings.loading+info,tooltip:tooltip,addClass:this.tree.options.classNames.nodeWait});}
break;case DTNodeStatus_Error:this.isLoading=false;this._setStatusNode({title:this.tree.options.strings.loadError+info,tooltip:tooltip,addClass:this.tree.options.classNames.nodeError});break;default:throw"Bad LazyNodeStatus: '"+lts+"'.";}},_parentList:function(includeRoot,includeSelf){var l=[];var dtn=includeSelf?this:this.parent;while(dtn){if(includeRoot||dtn.parent){l.unshift(dtn);}
dtn=dtn.parent;}
return l;},getLevel:function(){var level=0;var dtn=this.parent;while(dtn){level++;dtn=dtn.parent;}
return level;},_getTypeForOuterNodeEvent:function(event){var cns=this.tree.options.classNames;var target=event.target;if(target.className.indexOf(cns.node)<0){return null;}
var eventX=event.pageX-target.offsetLeft;var eventY=event.pageY-target.offsetTop;for(var i=0,l=target.childNodes.length;i<l;i++){var cn=target.childNodes[i];var x=cn.offsetLeft-target.offsetLeft;var y=cn.offsetTop-target.offsetTop;var nx=cn.clientWidth,ny=cn.clientHeight;if(eventX>=x&&eventX<=(x+nx)&&eventY>=y&&eventY<=(y+ny)){if(cn.className==cns.title){return"title";}else if(cn.className==cns.expander){return"expander";}else if(cn.className==cns.checkbox){return"checkbox";}else if(cn.className==cns.nodeIcon){return"icon";}}}
return"prefix";},getEventTargetType:function(event){var tcn=event&&event.target?event.target.className:"";var cns=this.tree.options.classNames;if(tcn===cns.title){return"title";}else if(tcn===cns.expander){return"expander";}else if(tcn===cns.checkbox){return"checkbox";}else if(tcn===cns.nodeIcon){return"icon";}else if(tcn===cns.empty||tcn===cns.vline||tcn===cns.connector){return"prefix";}else if(tcn.indexOf(cns.node)>=0){return this._getTypeForOuterNodeEvent(event);}
return null;},isVisible:function(){var parents=this._parentList(true,false);for(var i=0,l=parents.length;i<l;i++){if(!parents[i].bExpanded){return false;}}
return true;},makeVisible:function(){var parents=this._parentList(true,false);for(var i=0,l=parents.length;i<l;i++){parents[i]._expand(true);}},focus:function(){this.makeVisible();try{$(this.span).find(">a").focus();}catch(e){}},isFocused:function(){return(this.tree.tnFocused===this);},_activate:function(flag,fireEvents){this.tree.logDebug("dtnode._activate(%o, fireEvents=%o) - %o",flag,fireEvents,this);var opts=this.tree.options;if(this.data.isStatusNode){return;}
if(fireEvents&&opts.onQueryActivate&&opts.onQueryActivate.call(this.tree,flag,this)===false){return;}
if(flag){if(this.tree.activeNode){if(this.tree.activeNode===this){return;}
this.tree.activeNode.deactivate();}
if(opts.activeVisible){this.makeVisible();}
this.tree.activeNode=this;if(opts.persist){$.cookie(opts.cookieId+"-active",this.data.key,opts.cookie);}
this.tree.persistence.activeKey=this.data.key;$(this.span).addClass(opts.classNames.active);if(fireEvents&&opts.onActivate){opts.onActivate.call(this.tree,this);}}else{if(this.tree.activeNode===this){if(opts.onQueryActivate&&opts.onQueryActivate.call(this.tree,false,this)===false){return;}
$(this.span).removeClass(opts.classNames.active);if(opts.persist){$.cookie(opts.cookieId+"-active","",opts.cookie);}
this.tree.persistence.activeKey=null;this.tree.activeNode=null;if(fireEvents&&opts.onDeactivate){opts.onDeactivate.call(this.tree,this);}}}},activate:function(){this._activate(true,true);},activateSilently:function(){this._activate(true,false);},deactivate:function(){this._activate(false,true);},isActive:function(){return(this.tree.activeNode===this);},_userActivate:function(){var activate=true;var expand=false;if(this.data.isFolder){switch(this.tree.options.clickFolderMode){case 2:activate=false;expand=true;break;case 3:activate=expand=true;break;}}
if(this.parent===null){expand=false;}
if(expand){this.toggleExpand();this.focus();}
if(activate){this.activate();}},_setSubSel:function(hasSubSel){if(hasSubSel){this.hasSubSel=true;$(this.span).addClass(this.tree.options.classNames.partsel);}else{this.hasSubSel=false;$(this.span).removeClass(this.tree.options.classNames.partsel);}},_fixSelectionState:function(){var p,i,l;if(this.bSelected){this.visit(function(node){node.parent._setSubSel(true);node._select(true,false,false);});p=this.parent;while(p){p._setSubSel(true);var allChildsSelected=true;for(i=0,l=p.childList.length;i<l;i++){var n=p.childList[i];if(!n.bSelected&&!n.data.isStatusNode){allChildsSelected=false;break;}}
if(allChildsSelected){p._select(true,false,false);}
p=p.parent;}}else{this._setSubSel(false);this.visit(function(node){node._setSubSel(false);node._select(false,false,false);});p=this.parent;while(p){p._select(false,false,false);var isPartSel=false;for(i=0,l=p.childList.length;i<l;i++){if(p.childList[i].bSelected||p.childList[i].hasSubSel){isPartSel=true;break;}}
p._setSubSel(isPartSel);p=p.parent;}}},_select:function(sel,fireEvents,deep){var opts=this.tree.options;if(this.data.isStatusNode){return;}
if(this.bSelected===sel){return;}
if(fireEvents&&opts.onQuerySelect&&opts.onQuerySelect.call(this.tree,sel,this)===false){return;}
if(opts.selectMode==1&&sel){this.tree.visit(function(node){if(node.bSelected){node._select(false,false,false);return false;}});}
this.bSelected=sel;if(sel){if(opts.persist){this.tree.persistence.addSelect(this.data.key);}
$(this.span).addClass(opts.classNames.selected);if(deep&&opts.selectMode===3){this._fixSelectionState();}
if(fireEvents&&opts.onSelect){opts.onSelect.call(this.tree,true,this);}}else{if(opts.persist){this.tree.persistence.clearSelect(this.data.key);}
$(this.span).removeClass(opts.classNames.selected);if(deep&&opts.selectMode===3){this._fixSelectionState();}
if(fireEvents&&opts.onSelect){opts.onSelect.call(this.tree,false,this);}}},select:function(sel){if(this.data.unselectable){return this.bSelected;}
return this._select(sel!==false,true,true);},toggleSelect:function(){return this.select(!this.bSelected);},isSelected:function(){return this.bSelected;},_loadContent:function(){try{var opts=this.tree.options;this.tree.logDebug("_loadContent: start - %o",this);this.setLazyNodeStatus(DTNodeStatus_Loading);if(true===opts.onLazyRead.call(this.tree,this)){this.setLazyNodeStatus(DTNodeStatus_Ok);this.tree.logDebug("_loadContent: succeeded - %o",this);}}catch(e){this.tree.logWarning("_loadContent: failed - %o",e);this.setLazyNodeStatus(DTNodeStatus_Error,{tooltip:""+e});}},_expand:function(bExpand,forceSync){if(this.bExpanded===bExpand){this.tree.logDebug("dtnode._expand(%o) IGNORED - %o",bExpand,this);return;}
this.tree.logDebug("dtnode._expand(%o) - %o",bExpand,this);var opts=this.tree.options;if(!bExpand&&this.getLevel()<opts.minExpandLevel){this.tree.logDebug("dtnode._expand(%o) prevented collapse - %o",bExpand,this);return;}
if(opts.onQueryExpand&&opts.onQueryExpand.call(this.tree,bExpand,this)===false){return;}
this.bExpanded=bExpand;if(opts.persist){if(bExpand){this.tree.persistence.addExpand(this.data.key);}else{this.tree.persistence.clearExpand(this.data.key);}}
var allowEffects=!(this.data.isLazy&&this.childList===null)&&!this.isLoading&&!forceSync;this.render(allowEffects);if(this.bExpanded&&this.parent&&opts.autoCollapse){var parents=this._parentList(false,true);for(var i=0,l=parents.length;i<l;i++){parents[i].collapseSiblings();}}
if(opts.activeVisible&&this.tree.activeNode&&!this.tree.activeNode.isVisible()){this.tree.activeNode.deactivate();}
if(bExpand&&this.data.isLazy&&this.childList===null&&!this.isLoading){this._loadContent();return;}
if(opts.onExpand){opts.onExpand.call(this.tree,bExpand,this);}},expand:function(flag){flag=(flag!==false);if(!this.childList&&!this.data.isLazy&&flag){return;}else if(this.parent===null&&!flag){return;}
this._expand(flag);},scheduleAction:function(mode,ms){if(this.tree.timer){clearTimeout(this.tree.timer);this.tree.logDebug("clearTimeout(%o)",this.tree.timer);}
var self=this;switch(mode){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){self.tree.logDebug("setTimeout: trigger expand");self.expand(true);},ms);break;case"activate":this.tree.timer=setTimeout(function(){self.tree.logDebug("setTimeout: trigger activate");self.activate();},ms);break;default:throw"Invalid mode "+mode;}
this.tree.logDebug("setTimeout(%s, %s): %s",mode,ms,this.tree.timer);},toggleExpand:function(){this.expand(!this.bExpanded);},collapseSiblings:function(){if(this.parent===null){return;}
var ac=this.parent.childList;for(var i=0,l=ac.length;i<l;i++){if(ac[i]!==this&&ac[i].bExpanded){ac[i]._expand(false);}}},_onClick:function(event){var targetType=this.getEventTargetType(event);if(targetType==="expander"){this.toggleExpand();this.focus();}else if(targetType==="checkbox"){this.toggleSelect();this.focus();}else{this._userActivate();var aTag=this.span.getElementsByTagName("a");if(aTag[0]){if(!$.browser.msie){aTag[0].focus();}}else{return true;}}
event.preventDefault();},_onDblClick:function(event){},_onKeydown:function(event){var handled=true,sib;switch(event.which){case 107:case 187:if(!this.bExpanded){this.toggleExpand();}
break;case 109:case 189:if(this.bExpanded){this.toggleExpand();}
break;case 32:this._userActivate();break;case 8:if(this.parent){this.parent.focus();}
break;case 37:if(this.bExpanded){this.toggleExpand();this.focus();}else if(this.parent&&this.parent.parent){this.parent.focus();}
break;case 39:if(!this.bExpanded&&(this.childList||this.data.isLazy)){this.toggleExpand();this.focus();}else if(this.childList){this.childList[0].focus();}
break;case 38:sib=this.getPrevSibling();while(sib&&sib.bExpanded&&sib.childList){sib=sib.childList[sib.childList.length-1];}
if(!sib&&this.parent&&this.parent.parent){sib=this.parent;}
if(sib){sib.focus();}
break;case 40:if(this.bExpanded&&this.childList){sib=this.childList[0];}else{var parents=this._parentList(false,true);for(var i=parents.length-1;i>=0;i--){sib=parents[i].getNextSibling();if(sib){break;}}}
if(sib){sib.focus();}
break;default:handled=false;}
if(handled){event.preventDefault();}},_onKeypress:function(event){},_onFocus:function(event){var opts=this.tree.options;if(event.type=="blur"||event.type=="focusout"){if(opts.onBlur){opts.onBlur.call(this.tree,this);}
if(this.tree.tnFocused){$(this.tree.tnFocused.span).removeClass(opts.classNames.focused);}
this.tree.tnFocused=null;if(opts.persist){$.cookie(opts.cookieId+"-focus","",opts.cookie);}}else if(event.type=="focus"||event.type=="focusin"){if(this.tree.tnFocused&&this.tree.tnFocused!==this){this.tree.logDebug("dtnode.onFocus: out of sync: curFocus: %o",this.tree.tnFocused);$(this.tree.tnFocused.span).removeClass(opts.classNames.focused);}
this.tree.tnFocused=this;if(opts.onFocus){opts.onFocus.call(this.tree,this);}
$(this.tree.tnFocused.span).addClass(opts.classNames.focused);if(opts.persist){$.cookie(opts.cookieId+"-focus",this.data.key,opts.cookie);}}},visit:function(fn,includeSelf){var res=true;if(includeSelf===true){res=fn(this);if(res===false||res=="skip"){return res;}}
if(this.childList){for(var i=0,l=this.childList.length;i<l;i++){res=this.childList[i].visit(fn,true);if(res===false){break;}}}
return res;},visitParents:function(fn,includeSelf){if(includeSelf&&fn(this)===false){return false;}
var p=this.parent;while(p){if(fn(p)===false){return false;}
p=p.parent;}
return true;},remove:function(){if(this===this.tree.root){throw"Cannot remove system root";}
return this.parent.removeChild(this);},removeChild:function(tn){var ac=this.childList;if(ac.length==1){if(tn!==ac[0]){throw"removeChild: invalid child";}
return this.removeChildren();}
if(tn===this.tree.activeNode){tn.deactivate();}
if(this.tree.options.persist){if(tn.bSelected){this.tree.persistence.clearSelect(tn.data.key);}
if(tn.bExpanded){this.tree.persistence.clearExpand(tn.data.key);}}
tn.removeChildren(true);this.ul.removeChild(tn.li);for(var i=0,l=ac.length;i<l;i++){if(ac[i]===tn){this.childList.splice(i,1);break;}}},removeChildren:function(isRecursiveCall,retainPersistence){this.tree.logDebug("%s.removeChildren(%o)",this,isRecursiveCall);var tree=this.tree;var ac=this.childList;if(ac){for(var i=0,l=ac.length;i<l;i++){var tn=ac[i];if(tn===tree.activeNode&&!retainPersistence){tn.deactivate();}
if(this.tree.options.persist&&!retainPersistence){if(tn.bSelected){this.tree.persistence.clearSelect(tn.data.key);}
if(tn.bExpanded){this.tree.persistence.clearExpand(tn.data.key);}}
tn.removeChildren(true,retainPersistence);if(this.ul){this.ul.removeChild(tn.li);}}
this.childList=null;}
if(!isRecursiveCall){this.isLoading=false;this.render();}},setTitle:function(title){this.fromDict({title:title});},reload:function(force){throw"Use reloadChildren() instead";},reloadChildren:function(callback){if(this.parent===null){throw"Use tree.reload() instead";}else if(!this.data.isLazy){throw"node.reloadChildren() requires lazy nodes.";}
if(callback){var self=this;var eventType="nodeLoaded.dynatree."+this.tree.$tree.attr("id")
+"."+this.data.key;this.tree.$tree.bind(eventType,function(e,node,isOk){self.tree.$tree.unbind(eventType);self.tree.logInfo("loaded %o, %o, %o",e,node,isOk);if(node!==self){throw"got invalid load event";}
callback.call(self.tree,node,isOk);});}
this.removeChildren();this._loadContent();},_loadKeyPath:function(keyPath,callback){var tree=this.tree;tree.logDebug("%s._loadKeyPath(%s)",this,keyPath);if(keyPath===""){throw"Key path must not be empty";}
var segList=keyPath.split(tree.options.keyPathSeparator);if(segList[0]===""){throw"Key path must be relative (don't start with '/')";}
var seg=segList.shift();for(var i=0,l=this.childList.length;i<l;i++){var child=this.childList[i];if(child.data.key===seg){if(segList.length===0){callback.call(tree,child,"ok");}else if(child.data.isLazy&&(child.childList===null||child.childList===undefined)){tree.logDebug("%s._loadKeyPath(%s) -> reloading %s...",this,keyPath,child);var self=this;child.reloadChildren(function(node,isOk){if(isOk){tree.logDebug("%s._loadKeyPath(%s) -> reloaded %s.",node,keyPath,node);callback.call(tree,child,"loaded");node._loadKeyPath(segList.join(tree.options.keyPathSeparator),callback);}else{tree.logWarning("%s._loadKeyPath(%s) -> reloadChildren() failed.",self,keyPath);callback.call(tree,child,"error");}});}else{callback.call(tree,child,"loaded");child._loadKeyPath(segList.join(tree.options.keyPathSeparator),callback);}
return;}}
tree.logWarning("Node not found: "+seg);return;},resetLazy:function(){if(this.parent===null){throw"Use tree.reload() instead";}else if(!this.data.isLazy){throw"node.resetLazy() requires lazy nodes.";}
this.expand(false);this.removeChildren();},_addChildNode:function(dtnode,beforeNode){var tree=this.tree;var opts=tree.options;var pers=tree.persistence;dtnode.parent=this;if(this.childList===null){this.childList=[];}else if(!beforeNode){if(this.childList.length>0){$(this.childList[this.childList.length-1].span).removeClass(opts.classNames.lastsib);}}
if(beforeNode){var iBefore=$.inArray(beforeNode,this.childList);if(iBefore<0){throw"<beforeNode> must be a child of <this>";}
this.childList.splice(iBefore,0,dtnode);}else{this.childList.push(dtnode);}
var isInitializing=tree.isInitializing();if(opts.persist&&pers.cookiesFound&&isInitializing){if(pers.activeKey==dtnode.data.key){tree.activeNode=dtnode;}
if(pers.focusedKey==dtnode.data.key){tree.focusNode=dtnode;}
dtnode.bExpanded=($.inArray(dtnode.data.key,pers.expandedKeyList)>=0);dtnode.bSelected=($.inArray(dtnode.data.key,pers.selectedKeyList)>=0);}else{if(dtnode.data.activate){tree.activeNode=dtnode;if(opts.persist){pers.activeKey=dtnode.data.key;}}
if(dtnode.data.focus){tree.focusNode=dtnode;if(opts.persist){pers.focusedKey=dtnode.data.key;}}
dtnode.bExpanded=(dtnode.data.expand===true);if(dtnode.bExpanded&&opts.persist){pers.addExpand(dtnode.data.key);}
dtnode.bSelected=(dtnode.data.select===true);if(dtnode.bSelected&&opts.persist){pers.addSelect(dtnode.data.key);}}
if(opts.minExpandLevel>=dtnode.getLevel()){this.bExpanded=true;}
if(dtnode.bSelected&&opts.selectMode==3){var p=this;while(p){if(!p.hasSubSel){p._setSubSel(true);}
p=p.parent;}}
if(tree.bEnableUpdate){this.render();}
return dtnode;},addChild:function(obj,beforeNode){if(typeof(obj)=="string"){throw"Invalid data type for "+obj;}else if(!obj||obj.length===0){return;}else if(obj instanceof DynaTreeNode){return this._addChildNode(obj,beforeNode);}
if(!obj.length){obj=[obj];}
var prevFlag=this.tree.enableUpdate(false);var tnFirst=null;for(var i=0,l=obj.length;i<l;i++){var data=obj[i];var dtnode=this._addChildNode(new DynaTreeNode(this,this.tree,data),beforeNode);if(!tnFirst){tnFirst=dtnode;}
if(data.children){dtnode.addChild(data.children,null);}}
this.tree.enableUpdate(prevFlag);return tnFirst;},append:function(obj){this.tree.logWarning("node.append() is deprecated (use node.addChild() instead).");return this.addChild(obj,null);},appendAjax:function(ajaxOptions){var self=this;this.removeChildren(false,true);this.setLazyNodeStatus(DTNodeStatus_Loading);if(ajaxOptions.debugLazyDelay){var ms=ajaxOptions.debugLazyDelay;ajaxOptions.debugLazyDelay=0;this.tree.logInfo("appendAjax: waiting for debugLazyDelay "+ms);setTimeout(function(){self.appendAjax(ajaxOptions);},ms);return;}
var orgSuccess=ajaxOptions.success;var orgError=ajaxOptions.error;var eventType="nodeLoaded.dynatree."+this.tree.$tree.attr("id")
+"."+this.data.key;var options=$.extend({},this.tree.options.ajaxDefaults,ajaxOptions,{success:function(data,textStatus){var prevPhase=self.tree.phase;self.tree.phase="init";if(options.postProcess){data=options.postProcess.call(this,data,this.dataType);}
if(!$.isArray(data)||data.length!==0){self.addChild(data,null);}
self.tree.phase="postInit";if(orgSuccess){orgSuccess.call(options,self);}
self.tree.logInfo("trigger "+eventType);self.tree.$tree.trigger(eventType,[self,true]);self.tree.phase=prevPhase;self.setLazyNodeStatus(DTNodeStatus_Ok);if($.isArray(data)&&data.length===0){self.childList=[];self.render();}},error:function(XMLHttpRequest,textStatus,errorThrown){self.tree.logWarning("appendAjax failed:",textStatus,":\n",XMLHttpRequest,"\n",errorThrown);if(orgError){orgError.call(options,self,XMLHttpRequest,textStatus,errorThrown);}
self.tree.$tree.trigger(eventType,[self,false]);self.setLazyNodeStatus(DTNodeStatus_Error,{info:textStatus,tooltip:""+errorThrown});}});$.ajax(options);},move:function(targetNode,mode){var pos;if(this===targetNode){return;}
if(!this.parent){throw"Cannot move system root";}
if(mode===undefined||mode=="over"){mode="child";}
var prevParent=this.parent;var targetParent=(mode==="child")?targetNode:targetNode.parent;if(targetParent.isDescendantOf(this)){throw"Cannot move a node to it's own descendant";}
if(this.parent.childList.length==1){this.parent.childList=null;this.parent.bExpanded=false;}else{pos=$.inArray(this,this.parent.childList);if(pos<0){throw"Internal error";}
this.parent.childList.splice(pos,1);}
this.parent.ul.removeChild(this.li);this.parent=targetParent;if(targetParent.hasChildren()){switch(mode){case"child":targetParent.childList.push(this);break;case"before":pos=$.inArray(targetNode,targetParent.childList);if(pos<0){throw"Internal error";}
targetParent.childList.splice(pos,0,this);break;case"after":pos=$.inArray(targetNode,targetParent.childList);if(pos<0){throw"Internal error";}
targetParent.childList.splice(pos+1,0,this);break;default:throw"Invalid mode "+mode;}}else{targetParent.childList=[this];if(!targetParent.ul){targetParent.ul=document.createElement("ul");targetParent.ul.style.display="none";targetParent.li.appendChild(targetParent.ul);}}
targetParent.ul.appendChild(this.li);if(this.tree!==targetNode.tree){this.visit(function(node){node.tree=targetNode.tree;},null,true);throw"Not yet implemented.";}
if(!prevParent.isDescendantOf(targetParent)){prevParent.render();}
if(!targetParent.isDescendantOf(prevParent)){targetParent.render();}},lastentry:undefined};var DynaTreeStatus=Class.create();DynaTreeStatus._getTreePersistData=function(cookieId,cookieOpts){var ts=new DynaTreeStatus(cookieId,cookieOpts);ts.read();return ts.toDict();};getDynaTreePersistData=DynaTreeStatus._getTreePersistData;DynaTreeStatus.prototype={initialize:function(cookieId,cookieOpts){this._log("DynaTreeStatus: initialize");if(cookieId===undefined){cookieId=$.ui.dynatree.prototype.options.cookieId;}
cookieOpts=$.extend({},$.ui.dynatree.prototype.options.cookie,cookieOpts);this.cookieId=cookieId;this.cookieOpts=cookieOpts;this.cookiesFound=undefined;this.activeKey=null;this.focusedKey=null;this.expandedKeyList=null;this.selectedKeyList=null;},_log:function(msg){Array.prototype.unshift.apply(arguments,["debug"]);_log.apply(this,arguments);},read:function(){this._log("DynaTreeStatus: read");this.cookiesFound=false;var cookie=$.cookie(this.cookieId+"-active");this.activeKey=(cookie===null)?"":cookie;if(cookie!==null){this.cookiesFound=true;}
cookie=$.cookie(this.cookieId+"-focus");this.focusedKey=(cookie===null)?"":cookie;if(cookie!==null){this.cookiesFound=true;}
cookie=$.cookie(this.cookieId+"-expand");this.expandedKeyList=(cookie===null)?[]:cookie.split(",");if(cookie!==null){this.cookiesFound=true;}
cookie=$.cookie(this.cookieId+"-select");this.selectedKeyList=(cookie===null)?[]:cookie.split(",");if(cookie!==null){this.cookiesFound=true;}},write:function(){this._log("DynaTreeStatus: write");$.cookie(this.cookieId+"-active",(this.activeKey===null)?"":this.activeKey,this.cookieOpts);$.cookie(this.cookieId+"-focus",(this.focusedKey===null)?"":this.focusedKey,this.cookieOpts);$.cookie(this.cookieId+"-expand",(this.expandedKeyList===null)?"":this.expandedKeyList.join(","),this.cookieOpts);$.cookie(this.cookieId+"-select",(this.selectedKeyList===null)?"":this.selectedKeyList.join(","),this.cookieOpts);},addExpand:function(key){this._log("addExpand(%o)",key);if($.inArray(key,this.expandedKeyList)<0){this.expandedKeyList.push(key);$.cookie(this.cookieId+"-expand",this.expandedKeyList.join(","),this.cookieOpts);}},clearExpand:function(key){this._log("clearExpand(%o)",key);var idx=$.inArray(key,this.expandedKeyList);if(idx>=0){this.expandedKeyList.splice(idx,1);$.cookie(this.cookieId+"-expand",this.expandedKeyList.join(","),this.cookieOpts);}},addSelect:function(key){this._log("addSelect(%o)",key);if($.inArray(key,this.selectedKeyList)<0){this.selectedKeyList.push(key);$.cookie(this.cookieId+"-select",this.selectedKeyList.join(","),this.cookieOpts);}},clearSelect:function(key){this._log("clearSelect(%o)",key);var idx=$.inArray(key,this.selectedKeyList);if(idx>=0){this.selectedKeyList.splice(idx,1);$.cookie(this.cookieId+"-select",this.selectedKeyList.join(","),this.cookieOpts);}},isReloading:function(){return this.cookiesFound===true;},toDict:function(){return{cookiesFound:this.cookiesFound,activeKey:this.activeKey,focusedKey:this.activeKey,expandedKeyList:this.expandedKeyList,selectedKeyList:this.selectedKeyList};},lastentry:undefined};var DynaTree=Class.create();DynaTree.version="$Version: 1.1.1$";DynaTree.prototype={initialize:function($widget){this.phase="init";this.$widget=$widget;this.options=$widget.options;this.$tree=$widget.element;this.timer=null;this.divTree=this.$tree.get(0);_initDragAndDrop(this);},_load:function(callback){var $widget=this.$widget;var opts=this.options;this.bEnableUpdate=true;this._nodeCount=1;this.activeNode=null;this.focusNode=null;if(opts.rootVisible!==undefined){_log("warn","Option 'rootVisible' is no longer supported.");}
if(opts.minExpandLevel<1){_log("warn","Option 'minExpandLevel' must be >= 1.");opts.minExpandLevel=1;}
if(opts.classNames!==$.ui.dynatree.prototype.options.classNames){opts.classNames=$.extend({},$.ui.dynatree.prototype.options.classNames,opts.classNames);}
if(opts.ajaxDefaults!==$.ui.dynatree.prototype.options.ajaxDefaults){opts.ajaxDefaults=$.extend({},$.ui.dynatree.prototype.options.ajaxDefaults,opts.ajaxDefaults);}
if(opts.dnd!==$.ui.dynatree.prototype.options.dnd){opts.dnd=$.extend({},$.ui.dynatree.prototype.options.dnd,opts.dnd);}
if(!opts.imagePath){$("script").each(function(){var _rexDtLibName=/.*dynatree[^\/]*\.js$/i;if(this.src.search(_rexDtLibName)>=0){if(this.src.indexOf("/")>=0){opts.imagePath=this.src.slice(0,this.src.lastIndexOf("/"))+"/skin/";}else{opts.imagePath="skin/";}
logMsg("Guessing imagePath from '%s': '%s'",this.src,opts.imagePath);return false;}});}
this.persistence=new DynaTreeStatus(opts.cookieId,opts.cookie);if(opts.persist){if(!$.cookie){_log("warn","Please include jquery.cookie.js to use persistence.");}
this.persistence.read();}
this.logDebug("DynaTree.persistence: %o",this.persistence.toDict());this.cache={tagEmpty:"<span class='"+opts.classNames.empty+"'></span>",tagVline:"<span class='"+opts.classNames.vline+"'></span>",tagExpander:"<span class='"+opts.classNames.expander+"'></span>",tagConnector:"<span class='"+opts.classNames.connector+"'></span>",tagNodeIcon:"<span class='"+opts.classNames.nodeIcon+"'></span>",tagCheckbox:"<span class='"+opts.classNames.checkbox+"'></span>",lastentry:undefined};if(opts.children||(opts.initAjax&&opts.initAjax.url)||opts.initId){$(this.divTree).empty();}
var $ulInitialize=this.$tree.find(">ul:first").hide();this.tnRoot=new DynaTreeNode(null,this,{});this.tnRoot.bExpanded=true;this.tnRoot.render();this.divTree.appendChild(this.tnRoot.ul);var root=this.tnRoot;var isReloading=(opts.persist&&this.persistence.isReloading());var isLazy=false;var prevFlag=this.enableUpdate(false);this.logDebug("Dynatree._load(): read tree structure...");if(opts.children){root.addChild(opts.children);}else if(opts.initAjax&&opts.initAjax.url){isLazy=true;root.data.isLazy=true;this._reloadAjax(callback);}else if(opts.initId){this._createFromTag(root,$("#"+opts.initId));}else{this._createFromTag(root,$ulInitialize);$ulInitialize.remove();}
this._checkConsistency();this.logDebug("Dynatree._load(): render nodes...");this.enableUpdate(prevFlag);this.logDebug("Dynatree._load(): bind events...");this.$widget.bind();this.logDebug("Dynatree._load(): postInit...");this.phase="postInit";if(opts.persist){this.persistence.write();}
if(this.focusNode&&this.focusNode.isVisible()){this.logDebug("Focus on init: %o",this.focusNode);this.focusNode.focus();}
if(!isLazy&&opts.onPostInit){opts.onPostInit.call(this,isReloading,false);}
this.phase="idle";},_reloadAjax:function(callback){var opts=this.options;if(!opts.initAjax||!opts.initAjax.url){throw"tree.reload() requires 'initAjax' mode.";}
var pers=this.persistence;var ajaxOpts=$.extend({},opts.initAjax);if(ajaxOpts.addActiveKey){ajaxOpts.data.activeKey=pers.activeKey;}
if(ajaxOpts.addFocusedKey){ajaxOpts.data.focusedKey=pers.focusedKey;}
if(ajaxOpts.addExpandedKeyList){ajaxOpts.data.expandedKeyList=pers.expandedKeyList.join(",");}
if(ajaxOpts.addSelectedKeyList){ajaxOpts.data.selectedKeyList=pers.selectedKeyList.join(",");}
if(opts.onPostInit){if(ajaxOpts.success){this.logWarning("initAjax: success callback is ignored when onPostInit was specified.");}
if(ajaxOpts.error){this.logWarning("initAjax: error callback is ignored when onPostInit was specified.");}
var isReloading=pers.isReloading();ajaxOpts.success=function(dtnode){opts.onPostInit.call(dtnode.tree,isReloading,false);if(callback){callback.call(dtnode.tree,"ok");}};ajaxOpts.error=function(dtnode){opts.onPostInit.call(dtnode.tree,isReloading,true);if(callback){callback.call(dtnode.tree,"error");}};}
this.logDebug("Dynatree._init(): send Ajax request...");this.tnRoot.appendAjax(ajaxOpts);},toString:function(){return"Dynatree '"+this.$tree.attr("id")+"'";},toDict:function(){return this.tnRoot.toDict(true);},serializeArray:function(stopOnParents){var nodeList=this.getSelectedNodes(stopOnParents),name=this.$tree.attr("name")||this.$tree.attr("id"),arr=[];for(var i=0,l=nodeList.length;i<l;i++){arr.push({name:name,value:nodeList[i].data.key});}
return arr;},getPersistData:function(){return this.persistence.toDict();},logDebug:function(msg){if(this.options.debugLevel>=2){Array.prototype.unshift.apply(arguments,["debug"]);_log.apply(this,arguments);}},logInfo:function(msg){if(this.options.debugLevel>=1){Array.prototype.unshift.apply(arguments,["info"]);_log.apply(this,arguments);}},logWarning:function(msg){Array.prototype.unshift.apply(arguments,["warn"]);_log.apply(this,arguments);},isInitializing:function(){return(this.phase=="init"||this.phase=="postInit");},isReloading:function(){return(this.phase=="init"||this.phase=="postInit")&&this.options.persist&&this.persistence.cookiesFound;},isUserEvent:function(){return(this.phase=="userEvent");},redraw:function(){this.tnRoot.render(false,false);},renderInvisibleNodes:function(){this.tnRoot.render(false,true);},reload:function(callback){this._load(callback);},getRoot:function(){return this.tnRoot;},enable:function(){this.$widget.enable();},disable:function(){this.$widget.disable();},getNodeByKey:function(key){var el=document.getElementById(this.options.idPrefix+key);if(el){return el.dtnode?el.dtnode:null;}
var match=null;this.visit(function(node){if(node.data.key==key){match=node;return false;}},true);return match;},getActiveNode:function(){return this.activeNode;},reactivate:function(setFocus){var node=this.activeNode;if(node){this.activeNode=null;node.activate();if(setFocus){node.focus();}}},getSelectedNodes:function(stopOnParents){var nodeList=[];this.tnRoot.visit(function(node){if(node.bSelected){nodeList.push(node);if(stopOnParents===true){return"skip";}}});return nodeList;},activateKey:function(key){var dtnode=(key===null)?null:this.getNodeByKey(key);if(!dtnode){if(this.activeNode){this.activeNode.deactivate();}
this.activeNode=null;return null;}
dtnode.focus();dtnode.activate();return dtnode;},loadKeyPath:function(keyPath,callback){var segList=keyPath.split(this.options.keyPathSeparator);if(segList[0]===""){segList.shift();}
if(segList[0]==this.tnRoot.data.key){this.logDebug("Removed leading root key.");segList.shift();}
keyPath=segList.join(this.options.keyPathSeparator);return this.tnRoot._loadKeyPath(keyPath,callback);},selectKey:function(key,select){var dtnode=this.getNodeByKey(key);if(!dtnode){return null;}
dtnode.select(select);return dtnode;},enableUpdate:function(bEnable){if(this.bEnableUpdate==bEnable){return bEnable;}
this.bEnableUpdate=bEnable;if(bEnable){this.redraw();}
return!bEnable;},count:function(){return this.tnRoot.countChildren();},visit:function(fn,includeRoot){return this.tnRoot.visit(fn,includeRoot);},_createFromTag:function(parentTreeNode,$ulParent){var self=this;$ulParent.find(">li").each(function(){var $li=$(this);var $liSpan=$li.find(">span:first");var title;if($liSpan.length){title=$liSpan.html();}else{title=$li.html();var iPos=title.search(/<ul/i);if(iPos>=0){title=$.trim(title.substring(0,iPos));}else{title=$.trim(title);}}
var data={title:title,isFolder:$li.hasClass("folder"),isLazy:$li.hasClass("lazy"),expand:$li.hasClass("expanded"),select:$li.hasClass("selected"),activate:$li.hasClass("active"),focus:$li.hasClass("focused"),noLink:$li.hasClass("noLink")};if($li.attr("title")){data.tooltip=$li.attr("title");}
if($li.attr("id")){data.key=$li.attr("id");}
if($li.attr("data")){var dataAttr=$.trim($li.attr("data"));if(dataAttr){if(dataAttr.charAt(0)!="{"){dataAttr="{"+dataAttr+"}";}
try{$.extend(data,eval("("+dataAttr+")"));}catch(e){throw("Error parsing node data: "+e+"\ndata:\n'"+dataAttr+"'");}}}
var childNode=parentTreeNode.addChild(data);var $ul=$li.find(">ul:first");if($ul.length){self._createFromTag(childNode,$ul);}});},_checkConsistency:function(){},_setDndStatus:function(sourceNode,targetNode,helper,hitMode,accept){var $source=sourceNode?$(sourceNode.span):null;var $target=$(targetNode.span);if(!this.$dndMarker){this.$dndMarker=$("<div id='dynatree-drop-marker'></div>").hide().prependTo($(this.divTree).parent());}
if(hitMode==="after"||hitMode==="before"||hitMode==="over"){var pos=$target.position();switch(hitMode){case"before":this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-over");this.$dndMarker.addClass("dynatree-drop-before");pos.top-=8;break;case"after":this.$dndMarker.removeClass("dynatree-drop-before dynatree-drop-over");this.$dndMarker.addClass("dynatree-drop-after");pos.top+=8;break;default:this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-before");this.$dndMarker.addClass("dynatree-drop-over");$target.addClass("dynatree-drop-target");pos.left+=8;}
this.$dndMarker.css({"left":(pos.left)+"px","top":(pos.top)+"px"}).show();}else{$target.removeClass("dynatree-drop-target");this.$dndMarker.hide();}
if(hitMode==="after"){$target.addClass("dynatree-drop-after");}else{$target.removeClass("dynatree-drop-after");}
if(hitMode==="before"){$target.addClass("dynatree-drop-before");}else{$target.removeClass("dynatree-drop-before");}
if(accept===true){if($source){$source.addClass("dynatree-drop-accept");}
$target.addClass("dynatree-drop-accept");helper.addClass("dynatree-drop-accept");}else{if($source){$source.removeClass("dynatree-drop-accept");}
$target.removeClass("dynatree-drop-accept");helper.removeClass("dynatree-drop-accept");}
if(accept===false){if($source){$source.addClass("dynatree-drop-reject");}
$target.addClass("dynatree-drop-reject");helper.addClass("dynatree-drop-reject");}else{if($source){$source.removeClass("dynatree-drop-reject");}
$target.removeClass("dynatree-drop-reject");helper.removeClass("dynatree-drop-reject");}},_onDragEvent:function(eventName,node,otherNode,event,ui,draggable){var opts=this.options;var dnd=this.options.dnd;var res=null;var nodeTag=$(node.span);var hitMode;switch(eventName){case"helper":var helper=$("<div class='dynatree-drag-helper'><span class='dynatree-drag-helper-img' /></div>").append($(event.target).closest('a').clone());helper.data("dtSourceNode",node);res=helper;break;case"start":if(node.isStatusNode()){res=false;}else if(dnd.onDragStart){res=dnd.onDragStart(node);}
if(res===false){this.logDebug("tree.onDragStart() cancelled");ui.helper.trigger("mouseup");ui.helper.hide();}else{nodeTag.addClass("dynatree-drag-source");}
break;case"enter":res=dnd.onDragEnter?dnd.onDragEnter(node,otherNode):null;res={over:(res!==false)&&((res===true)||(res==="over")||$.inArray("over",res)>=0),before:(res!==false)&&((res===true)||(res==="before")||$.inArray("before",res)>=0),after:(res!==false)&&((res===true)||(res==="after")||$.inArray("after",res)>=0)};ui.helper.data("enterResponse",res);break;case"over":var enterResponse=ui.helper.data("enterResponse");hitMode=null;if(enterResponse===false){break;}else if(typeof enterResponse==="string"){hitMode=enterResponse;}else{var nodeOfs=nodeTag.offset();var relPos={x:event.pageX-nodeOfs.left,y:event.pageY-nodeOfs.top};var relPos2={x:relPos.x/nodeTag.width(),y:relPos.y/nodeTag.height()};if(enterResponse.after&&relPos2.y>0.75){hitMode="after";}else if(!enterResponse.over&&enterResponse.after&&relPos2.y>0.5){hitMode="after";}else if(enterResponse.before&&relPos2.y<=0.25){hitMode="before";}else if(!enterResponse.over&&enterResponse.before&&relPos2.y<=0.5){hitMode="before";}else if(enterResponse.over){hitMode="over";}
if(dnd.preventVoidMoves){if(node===otherNode){hitMode=null;}else if(hitMode==="before"&&otherNode&&node===otherNode.getNextSibling()){hitMode=null;}else if(hitMode==="after"&&otherNode&&node===otherNode.getPrevSibling()){hitMode=null;}else if(hitMode==="over"&&otherNode&&otherNode.parent===node&&otherNode.isLastSibling()){hitMode=null;}}
ui.helper.data("hitMode",hitMode);}
if(hitMode==="over"&&dnd.autoExpandMS&&node.hasChildren()!==false&&!node.bExpanded){node.scheduleAction("expand",dnd.autoExpandMS);}
if(hitMode&&dnd.onDragOver){res=dnd.onDragOver(node,otherNode,hitMode);}
this._setDndStatus(otherNode,node,ui.helper,hitMode,res!==false);break;case"drop":hitMode=ui.helper.data("hitMode");if(hitMode&&dnd.onDrop){dnd.onDrop(node,otherNode,hitMode,ui,draggable);}
break;case"leave":node.scheduleAction("cancel");ui.helper.data("enterResponse",null);ui.helper.data("hitMode",null);this._setDndStatus(otherNode,node,ui.helper,"out",undefined);if(dnd.onDragLeave){dnd.onDragLeave(node,otherNode);}
break;case"stop":nodeTag.removeClass("dynatree-drag-source");if(dnd.onDragStop){dnd.onDragStop(node);}
break;default:throw"Unsupported drag event: "+eventName;}
return res;},cancelDrag:function(){var dd=$.ui.ddmanager.current;if(dd){dd.cancel();}},lastentry:undefined};$.widget("ui.dynatree",{_init:function(){if(parseFloat($.ui.version)<1.8){_log("warn","ui.dynatree._init() was called; you should upgrade to jquery.ui.core.js v1.8 or higher.");return this._create();}
_log("debug","ui.dynatree._init() was called; no current default functionality.");},_create:function(){logMsg("Dynatree._create(): version='%s', debugLevel=%o.",DynaTree.version,this.options.debugLevel);var opts=this.options;this.options.event+=".dynatree";var divTree=this.element.get(0);this.tree=new DynaTree(this);this.tree._load();this.tree.logDebug("Dynatree._init(): done.");},bind:function(){this.unbind();var eventNames="click.dynatree dblclick.dynatree";if(this.options.keyboard){eventNames+=" keypress.dynatree keydown.dynatree";}
this.element.bind(eventNames,function(event){var dtnode=getDtNodeFromElement(event.target);if(!dtnode){return true;}
var tree=dtnode.tree;var o=tree.options;tree.logDebug("event(%s): dtnode: %s",event.type,dtnode);var prevPhase=tree.phase;tree.phase="userEvent";try{switch(event.type){case"click":return(o.onClick&&o.onClick.call(tree,dtnode,event)===false)?false:dtnode._onClick(event);case"dblclick":return(o.onDblClick&&o.onDblClick.call(tree,dtnode,event)===false)?false:dtnode._onDblClick(event);case"keydown":return(o.onKeydown&&o.onKeydown.call(tree,dtnode,event)===false)?false:dtnode._onKeydown(event);case"keypress":return(o.onKeypress&&o.onKeypress.call(tree,dtnode,event)===false)?false:dtnode._onKeypress(event);}}catch(e){var _=null;tree.logWarning("bind(%o): dtnode: %o, error: %o",event,dtnode,e);}finally{tree.phase=prevPhase;}});function __focusHandler(event){event=$.event.fix(event||window.event);var dtnode=getDtNodeFromElement(event.target);return dtnode?dtnode._onFocus(event):false;}
var div=this.tree.divTree;if(div.addEventListener){div.addEventListener("focus",__focusHandler,true);div.addEventListener("blur",__focusHandler,true);}else{div.onfocusin=div.onfocusout=__focusHandler;}},unbind:function(){this.element.unbind(".dynatree");},enable:function(){this.bind();$.Widget.prototype.enable.apply(this,arguments);},disable:function(){this.unbind();$.Widget.prototype.disable.apply(this,arguments);},getTree:function(){return this.tree;},getRoot:function(){return this.tree.getRoot();},getActiveNode:function(){return this.tree.getActiveNode();},getSelectedNodes:function(){return this.tree.getSelectedNodes();},lastentry:undefined});if(parseFloat($.ui.version)<1.8){$.ui.dynatree.getter="getTree getRoot getActiveNode getSelectedNodes";}
$.ui.dynatree.prototype.options={title:"Dynatree",minExpandLevel:1,imagePath:null,children:null,initId:null,initAjax:null,autoFocus:true,keyboard:true,persist:false,autoCollapse:false,clickFolderMode:3,activeVisible:true,checkbox:false,selectMode:2,fx:null,noLink:false,onClick:null,onDblClick:null,onKeydown:null,onKeypress:null,onFocus:null,onBlur:null,onQueryActivate:null,onQuerySelect:null,onQueryExpand:null,onPostInit:null,onActivate:null,onDeactivate:null,onSelect:null,onExpand:null,onLazyRead:null,onCustomRender:null,onRender:null,dnd:{onDragStart:null,onDragStop:null,autoExpandMS:1000,preventVoidMoves:true,onDragEnter:null,onDragOver:null,onDrop:null,onDragLeave:null},ajaxDefaults:{cache:false,dataType:"json"},strings:{loading:"Loading&#8230;",loadError:"Load error!"},generateIds:false,idPrefix:"dynatree-id-",keyPathSeparator:"/",cookieId:"dynatree",cookie:{expires:null},classNames:{container:"dynatree-container",node:"dynatree-node",folder:"dynatree-folder",empty:"dynatree-empty",vline:"dynatree-vline",expander:"dynatree-expander",connector:"dynatree-connector",checkbox:"dynatree-checkbox",nodeIcon:"dynatree-icon",title:"dynatree-title",noConnector:"dynatree-no-connector",nodeError:"dynatree-statusnode-error",nodeWait:"dynatree-statusnode-wait",hidden:"dynatree-hidden",combinedExpanderPrefix:"dynatree-exp-",combinedIconPrefix:"dynatree-ico-",nodeLoading:"dynatree-loading",hasChildren:"dynatree-has-children",active:"dynatree-active",selected:"dynatree-selected",expanded:"dynatree-expanded",lazy:"dynatree-lazy",focused:"dynatree-focused",partsel:"dynatree-partsel",lastsib:"dynatree-lastsib"},debugLevel:1,lastentry:undefined};if(parseFloat($.ui.version)<1.8){$.ui.dynatree.defaults=$.ui.dynatree.prototype.options;}
$.ui.dynatree.nodedatadefaults={title:null,key:null,isFolder:false,isLazy:false,tooltip:null,icon:null,addClass:null,noLink:false,activate:false,focus:false,expand:false,select:false,hideCheckbox:false,unselectable:false,children:null,lastentry:undefined};function _initDragAndDrop(tree){var dnd=tree.options.dnd||null;if(dnd&&(dnd.onDragStart||dnd.onDrop)){_registerDnd();}
if(dnd&&dnd.onDragStart){tree.$tree.draggable({addClasses:false,appendTo:"body",containment:false,delay:0,distance:4,revert:false,connectToDynatree:true,helper:function(event){var sourceNode=getDtNodeFromElement(event.target);return sourceNode.tree._onDragEvent("helper",sourceNode,null,event,null,null);},_last:null});}
if(dnd&&dnd.onDrop){tree.$tree.droppable({addClasses:false,tolerance:"intersect",greedy:false,_last:null});}}
var didRegisterDnd=false;var _registerDnd=function(){if(didRegisterDnd){return;}
$.ui.plugin.add("draggable","connectToDynatree",{start:function(event,ui){var draggable=$(this).data("draggable");var sourceNode=ui.helper.data("dtSourceNode")||null;if(sourceNode){draggable.offset.click.top=-2;draggable.offset.click.left=+16;return sourceNode.tree._onDragEvent("start",sourceNode,null,event,ui,draggable);}},drag:function(event,ui){var draggable=$(this).data("draggable");var sourceNode=ui.helper.data("dtSourceNode")||null;var prevTargetNode=ui.helper.data("dtTargetNode")||null;var targetNode=getDtNodeFromElement(event.target);if(event.target&&!targetNode){var isHelper=$(event.target).closest("div.dynatree-drag-helper,#dynatree-drop-marker").length>0;if(isHelper){return;}}
ui.helper.data("dtTargetNode",targetNode);if(prevTargetNode&&prevTargetNode!==targetNode){prevTargetNode.tree._onDragEvent("leave",prevTargetNode,sourceNode,event,ui,draggable);}
if(targetNode){if(!targetNode.tree.options.dnd.onDrop){noop();}else if(targetNode===prevTargetNode){targetNode.tree._onDragEvent("over",targetNode,sourceNode,event,ui,draggable);}else{targetNode.tree._onDragEvent("enter",targetNode,sourceNode,event,ui,draggable);}}},stop:function(event,ui){var draggable=$(this).data("draggable");var sourceNode=ui.helper.data("dtSourceNode")||null;var targetNode=ui.helper.data("dtTargetNode")||null;var mouseDownEvent=draggable._mouseDownEvent;var eventType=event.type;var dropped=(eventType=="mouseup"&&event.which==1);if(!dropped){logMsg("Drag was cancelled");}
if(targetNode){if(dropped){targetNode.tree._onDragEvent("drop",targetNode,sourceNode,event,ui,draggable);}
targetNode.tree._onDragEvent("leave",targetNode,sourceNode,event,ui,draggable);}
if(sourceNode){sourceNode.tree._onDragEvent("stop",sourceNode,null,event,ui,draggable);}}});didRegisterDnd=true;};})(jQuery);

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

View File

@@ -0,0 +1,441 @@
/*******************************************************************************
* Tree container
*/
ul.dynatree-container
{
font-family: tahoma, arial, helvetica;
font-size: 10pt; /* font size should not be too big */
white-space: nowrap;
padding: 3px;
background-color: white;
border: 1px dotted gray;
overflow: auto;
}
ul.dynatree-container ul
{
padding: 0 0 0 16px;
margin: 0;
}
ul.dynatree-container li
{
list-style-image: none;
list-style-position: outside;
list-style-type: none;
-moz-background-clip:border;
-moz-background-inline-policy: continuous;
-moz-background-origin: padding;
background-attachment: scroll;
background-color: transparent;
background-repeat: repeat-y;
background-image: url("vline.gif");
background-position: 0 0;
/*
background-image: url("icons_96x256.gif");
background-position: -80px -64px;
*/
margin: 0;
padding: 1px 0 0 0;
}
/* Suppress lines for last child node */
ul.dynatree-container li.dynatree-lastsib
{
background-image: none;
}
/* Suppress lines if level is fixed expanded (option minExpandLevel) */
ul.dynatree-no-connector > li
{
background-image: none;
}
/* Style, when control is disabled */
.ui-dynatree-disabled ul.dynatree-container
{
opacity: 0.5;
/* filter: alpha(opacity=50); /* Yields a css warning */
background-color: silver;
}
/*******************************************************************************
* Common icon definitions
*/
span.dynatree-empty,
span.dynatree-vline,
span.dynatree-connector,
span.dynatree-expander,
span.dynatree-icon,
span.dynatree-checkbox,
span.dynatree-radio,
span.dynatree-drag-helper-img,
#dynatree-drop-marker
{
width: 16px;
height: 16px;
display: -moz-inline-box; /* @ FF 1+2 */
display: inline-block; /* Required to make a span sizeable */
vertical-align: top;
background-repeat: no-repeat;
background-position: left;
background-image: url("icons.gif");
background-position: 0 0;
}
/** Used by 'icon' node option: */
ul.dynatree-container img
{
width: 16px;
height: 16px;
margin-left: 3px;
vertical-align: top;
border-style: none;
}
/*******************************************************************************
* Lines and connectors
*/
span.dynatree-connector
{
background-position: -16px -64px;
}
/*******************************************************************************
* Expander icon
* Note: IE6 doesn't correctly evaluate multiples class names,
* so we create combined class names that can be used in the CSS.
*
* Prefix: dynatree-exp-
* 1st character: 'e': expanded, 'c': collapsed
* 2nd character (optional): 'd': lazy (Delayed)
* 3rd character (optional): 'l': Last sibling
*/
span.dynatree-expander
{
background-position: 0px -80px;
cursor: pointer;
}
.dynatree-exp-cl span.dynatree-expander /* Collapsed, not delayed, last sibling */
{
background-position: 0px -96px;
}
.dynatree-exp-cd span.dynatree-expander /* Collapsed, delayed, not last sibling */
{
background-position: -64px -80px;
}
.dynatree-exp-cdl span.dynatree-expander /* Collapsed, delayed, last sibling */
{
background-position: -64px -96px;
}
.dynatree-exp-e span.dynatree-expander, /* Expanded, not delayed, not last sibling */
.dynatree-exp-ed span.dynatree-expander /* Expanded, delayed, not last sibling */
{
background-position: -32px -80px;
}
.dynatree-exp-el span.dynatree-expander, /* Expanded, not delayed, last sibling */
.dynatree-exp-edl span.dynatree-expander /* Expanded, delayed, last sibling */
{
background-position: -32px -96px;
}
.dynatree-loading span.dynatree-expander /* 'Loading' status overrides all others */
{
background-position: 0 0;
background-image: url("loading.gif");
}
/*******************************************************************************
* Checkbox icon
*/
span.dynatree-checkbox
{
margin-left: 3px;
background-position: 0px -32px;
}
span.dynatree-checkbox:hover
{
background-position: -16px -32px;
}
.dynatree-partsel span.dynatree-checkbox
{
background-position: -64px -32px;
}
.dynatree-partsel span.dynatree-checkbox:hover
{
background-position: -80px -32px;
}
.dynatree-selected span.dynatree-checkbox
{
background-position: -32px -32px;
}
.dynatree-selected span.dynatree-checkbox:hover
{
background-position: -48px -32px;
}
/*******************************************************************************
* Radiobutton icon
* This is a customization, that may be activated by overriding the 'checkbox'
* class name as 'dynatree-radio' in the tree options.
*/
span.dynatree-radio
{
margin-left: 3px;
background-position: 0px -48px;
}
span.dynatree-radio:hover
{
background-position: -16px -48px;
}
.dynatree-partsel span.dynatree-radio
{
background-position: -64px -48px;
}
.dynatree-partsel span.dynatree-radio:hover
{
background-position: -80px -48px;
}
.dynatree-selected span.dynatree-radio
{
background-position: -32px -48px;
}
.dynatree-selected span.dynatree-radio:hover
{
background-position: -48px -48px;
}
/*******************************************************************************
* Node type icon
* Note: IE6 doesn't correctly evaluate multiples class names,
* so we create combined class names that can be used in the CSS.
*
* Prefix: dynatree-ico-
* 1st character: 'e': expanded, 'c': collapsed
* 2nd character (optional): 'f': folder
*/
span.dynatree-icon /* Default icon */
{
margin-left: 3px;
background-position: 0px 0px;
}
.dynatree-ico-cf span.dynatree-icon /* Collapsed Folder */
{
background-position: 0px -16px;
}
.dynatree-ico-ef span.dynatree-icon /* Expanded Folder */
{
background-position: -64px -16px;
}
/* Status node icons */
.dynatree-statusnode-wait span.dynatree-icon
{
background-image: url("loading.gif");
}
.dynatree-statusnode-error span.dynatree-icon
{
background-position: 0px -112px;
/* background-image: url("ltError.gif");*/
}
/*******************************************************************************
* Node titles
*/
/* @Chrome: otherwise hit area of node titles is broken (issue 133)
Removed again for issue 165; (133 couldn't be reproduced) */
span.dynatree-node
{
/* display: -moz-inline-box; /* @ FF 1+2 */
/* display: inline-block; /* Required to make a span sizeable */
}
/* Remove blue color and underline from title links */
ul.dynatree-container a
/*, ul.dynatree-container a:visited*/
{
color: black; /* inherit doesn't work on IE */
text-decoration: none;
vertical-align: top;
margin: 0px;
margin-left: 3px;
/* outline: 0; /* @ Firefox, prevent dotted border after click */
}
ul.dynatree-container a:hover
{
/* text-decoration: underline; */
background: #F2F7FD; /* light blue */
border-color: #B8D6FB; /* darker light blue */
}
span.dynatree-node a
{
display: inline-block; /* Better alignment, when title contains <br> */
/* vertical-align: top;*/
padding-left: 3px;
padding-right: 3px; /* Otherwise italic font will be outside bounds */
/* line-height: 16px; /* should be the same as img height, in case 16 px */
}
span.dynatree-folder a
{
font-weight: bold;
}
ul.dynatree-container a:focus,
span.dynatree-focused a:link /* @IE */
{
background-color: #EFEBDE; /* gray */
}
span.dynatree-has-children a
{
}
span.dynatree-expanded a
{
}
span.dynatree-selected a
{
color: green;
font-style: italic;
}
span.dynatree-active a
{
background-color: #3169C6 !important;
color: white !important; /* @ IE6 */
}
/*******************************************************************************
* Drag'n'drop support
*/
/*** Helper object ************************************************************/
div.dynatree-drag-helper
{
}
div.dynatree-drag-helper a
{
border: 1px solid gray;
background-color: white;
padding-left: 5px;
padding-right: 5px;
opacity: 0.8;
}
span.dynatree-drag-helper-img
{
/*
position: relative;
left: -16px;
*/
}
div.dynatree-drag-helper /*.dynatree-drop-accept*/
{
/* border-color: green;
background-color: red;*/
}
div.dynatree-drop-accept span.dynatree-drag-helper-img
{
background-position: -32px -112px;
}
div.dynatree-drag-helper.dynatree-drop-reject
{
border-color: red;
}
div.dynatree-drop-reject span.dynatree-drag-helper-img
{
background-position: -16px -112px;
}
/*** Drop marker icon *********************************************************/
#dynatree-drop-marker
{
width: 24px;
position: absolute;
background-position: 0 -128px;
}
#dynatree-drop-marker.dynatree-drop-after,
#dynatree-drop-marker.dynatree-drop-before
{
width:64px;
background-position: 0 -144px;
}
#dynatree-drop-marker.dynatree-drop-copy
{
background-position: -64px -128px;
}
#dynatree-drop-marker.dynatree-drop-move
{
background-position: -64px -128px;
}
/*** Source node while dragging ***********************************************/
span.dynatree-drag-source
{
/* border: 1px dotted gray; */
background-color: #e0e0e0;
}
span.dynatree-drag-source a
{
color: gray;
}
/*** Target node while dragging cursor is over it *****************************/
span.dynatree-drop-target
{
/*border: 1px solid gray;*/
}
span.dynatree-drop-target a
{
/*background-repeat: no-repeat;
background-position: right;
background-image: url("drop_child.gif");*/
}
span.dynatree-drop-target.dynatree-drop-accept a
{
/*border: 1px solid green;*/
background-color: #3169C6 !important;
color: white !important; /* @ IE6 */
text-decoration: none;
}
span.dynatree-drop-target.dynatree-drop-reject
{
/*border: 1px solid red;*/
}
span.dynatree-drop-target.dynatree-drop-after a
{
/*background-repeat: repeat-x;
background-position: bottom;
background-image: url("drop_append.gif");*/
}
/*******************************************************************************
* Custom node classes (sample)
*/
span.custom1 a
{
background-color: maroon;
color: yellow;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

View File

@@ -1,22 +0,0 @@
#inputarea {
height: 500px;
overflow: auto;
}
.rowdiv {
}
.selectimage {
width: 32px;
height: 32px;
}
#invisible {
display: none;
}
#datatable td {
padding: 2px 10px 2px 10px;
border-bottom: 1px black solid;
background-color: #dddddd;
}
.editorbutton {
margin-right: 20px;
}

View File

@@ -17,7 +17,7 @@ html,body { margin:0; padding:0; height: 100%; font-size: 0.9em; }
.fieldWithLabel .label { display: block; margin-top: 1ex; }
.fieldWithLabel .field { display: block; }
.fieldWithLabel .hint { }
.fieldWithLabel .fieldInput { }
.fieldWithLabel .fieldInput { vertical-align: top; }
.fieldSet { float: left; margin: 1ex; background-color: #f7f7ff; }
.endSets { clear: both; }
@@ -33,3 +33,8 @@ html,body { margin:0; padding:0; height: 100%; font-size: 0.9em; }
.fieldWithLabel table td { border: 1px #ccc solid; padding: 0.5ex; cursor: pointer; }
.fieldWithLabel table tbody tr:nth-child(even) { background-color: #eee }
.fieldWithLabel table tbody tr:hover { background-color: #d7d7ff; }
#dialogueTreeContainer { }
#dialogueTree { width: 400px; }
#dialogueData { }
input[readonly] { color: #888; }
.imageButton { padding: 5px; }