/* Initialize Bookmark Actions */ function bm_action(com,grid) { if (com=='Delete') { var check = confirm('Delete ' + $('.trSelected',grid).length + ' bookmark(s)?'); if(check == true) { $('.trSelected',grid).each(function(){ var url = "/api/ymarks/delete_ymark.xml?id="+$(this).find('td :first').text(); $.ajax({ type: 'POST', url: url, dataType: 'xml', success: function(xml) { $('#ymarks_flexigrid').flexReload(); loadTreeView(); } }); // close $.ajax( }); //close each( } } else if (com=='Add') { $('#bmaddform').resetForm(); $('#bm_tags').importTags(''); $("#bm_url").removeAttr("disabled"); $("#bm_url").blur(function() { var url = $("#bm_url").getValue(); $.ajax({ type: "GET", url: "/api/ymarks/get_metadata.xml?url="+url, dataType: "xml", success: function(xml) { var title = ""; var desc = ""; var tags = ""; if ($(xml).find('info').attr('status') === "error") { $("#bmaddimg").attr("src","/yacy/ui/img-1/Smiley Star Sad.png"); } else { var autotags = $(xml).find('autotags') title = $(xml).find('title').text(); desc = $(xml).find('desc').text(); tags = ""; $(autotags).find('tag').each(function(){ tags = tags + "," + $(this).attr('name'); }); $("#bmaddimg").attr("src","/yacy/ui/img-1/Smiley Star.png"); } $("#bm_title").setValue(title); $("#bm_desc").setValue(desc); /* $("#bm_tags").setValue(tags); */ $('#bm_tags').importTags(tags); } }); }); $("#ymarks_add_dialog").dialog('open'); } else if (com=='Edit') { if ($('.trSelected',grid).length > 1) { alert("Editing of more than one selected bookmark is currently not supportet!"); return false; } $("#bm_url").attr("disabled","disabled"); $("#bm_url").setValue($('.trSelected',grid).find('.url').text()); $("#bm_title").setValue($('.trSelected',grid).find('h3.linktitle').text().trim()); $("#bm_desc").setValue($('.trSelected',grid).find('p.desc').text().trim()); $('#bm_tags').importTags($('.trSelected',grid).find('p.tags').text().trim().replace(/,\s/g,",")); /* $("#bm_tags").setValue($('.trSelected',grid).find('p.tags').text().trim().replace(/,\s/g,",")); */ $("#bm_path").setValue($('.trSelected',grid).find('p.folders').text().replace(/,\s/g,",")); $("#bm_public").setValue($('.trSelected',grid).find('img').attr('alt')); $("#ymarks_add_dialog").dialog('open'); } else if (com=='Crawl') { if ($('.trSelected',grid).length == 1 && $(this).find('.apicall_pk').text() == "") { var pk = $(this).find('.apicall_pk').text(); $("input[name='crawlingURL']").setValue($('.trSelected',grid).find('.url').text()); $("#ymarks_crawlstart").dialog('open'); } else { var param = []; var i = 0; $('.trSelected',grid).each(function() { var pk = $(this).find('.apicall_pk').text(); if (pk == "") { /* if (crawl_param.length == 0) { $('