Added button to recommend new algorithm.
21
cgi-bin/sendEmail.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?
|
||||
/*
|
||||
Sample page
|
||||
*/
|
||||
|
||||
$mymail = "soft_support@list.ru";
|
||||
|
||||
header('Content-type: text/html; charset=utf-8');
|
||||
|
||||
$text = "New Algorithm!\n" . $_POST["text"];
|
||||
|
||||
$headers = 'MIME-Version: 1.0' . "\r\n";
|
||||
$headers .= 'Content-type: text/plain; charset=utf-8' . "\r\n";
|
||||
$headers .= "From: support@graphonline.ru \r\n";
|
||||
|
||||
echo ($headers);
|
||||
echo ($text);
|
||||
|
||||
mail($mymail, "New algorithm", $text, $headers);
|
||||
|
||||
?>
|
@ -66,6 +66,11 @@
|
||||
overflow-wrap: normal;
|
||||
}
|
||||
|
||||
#NeedAlgorithmMessage
|
||||
{
|
||||
width : 100%;
|
||||
}
|
||||
|
||||
#EdgeWeight
|
||||
{
|
||||
max-width : 80px;
|
||||
@ -103,7 +108,7 @@
|
||||
.ui-dialog-buttonset button
|
||||
{
|
||||
border: 1px solid #c5dbec;
|
||||
background: #dfeffc url("/themeroller/images/ui-bg_glass_85_dfeffc_1x400.png") 50% 50% repeat-x;
|
||||
background: #dfeffc url("images/ui-bg_glass_85_dfeffc_1x400.png") 50% 50% repeat-x;
|
||||
font-weight: bold;
|
||||
color: #2e6e9e;
|
||||
margin: .5em .4em .5em 0;
|
||||
|
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 351 B |
Before Width: | Height: | Size: 244 B |
Before Width: | Height: | Size: 301 B |
Before Width: | Height: | Size: 387 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 317 B |
Before Width: | Height: | Size: 367 B |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 6.3 KiB |
@ -102,4 +102,8 @@
|
||||
$g_lang["or"] = "or";
|
||||
$g_lang["vote"] = "Vote";
|
||||
$g_lang["vote_question"] = "What functions should we add firstly?";
|
||||
|
||||
$g_lang["what_algorithm_need"] = "Please, write what algorithm you are missing";
|
||||
|
||||
$g_lang["recommend_algorithm"] = "Recommend algorithms";
|
||||
?>
|
||||
|
@ -106,5 +106,9 @@
|
||||
$g_lang["or"] = "или";
|
||||
$g_lang["vote"] = "Опрос";
|
||||
$g_lang["vote_question"] = "Какие функции нам добавить в первую очередь?";
|
||||
$g_lang["what_algorithm_need"] = "Пожалуйста, напишите, какого алгоритма вам не хватает";
|
||||
|
||||
$g_lang["recommend_algorithm"] = "Рекомендовать алгоритмы";
|
||||
|
||||
|
||||
?>
|
||||
|
@ -118,6 +118,13 @@ BaseAlgorithm.prototype.getObjectSelectedGroup = function(object)
|
||||
// This methos is called, when messages was updated on html page.
|
||||
BaseAlgorithm.prototype.messageWasChanged = function() {}
|
||||
|
||||
// Algorithm priority in menu
|
||||
BaseAlgorithm.prototype.getPriority = function()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Default handler.
|
||||
|
@ -1136,9 +1136,14 @@ Application.prototype.getAlgorithmNames = function()
|
||||
oneFactory = factory(this.graph);
|
||||
obj.name = oneFactory.getName(g_language);
|
||||
obj.id = oneFactory.getId();
|
||||
obj.priority = oneFactory.getPriority();
|
||||
res.push(obj);
|
||||
}
|
||||
|
||||
res.sort(function (a, b) {
|
||||
return a.priority > b.priority;
|
||||
});
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,8 @@ function postLoadPage()
|
||||
|| ($('#saveDialog').hasClass('ui-dialog-content') && $('#saveDialog').dialog('isOpen'))
|
||||
|| ($('#saveImageDialog').hasClass('ui-dialog-content') && $('#saveImageDialog').dialog('isOpen'))
|
||||
|| ($('#GroupRenameDialog').hasClass('ui-dialog-content') && $('#GroupRenameDialog').dialog('isOpen'))
|
||||
|| $('#developerTools').css("display") != "none")
|
||||
|| $('#developerTools').css("display") != "none"
|
||||
|| ($('#NeedAlgorithm').hasClass('ui-dialog-content') && $('#NeedAlgorithm').dialog('isOpen')))
|
||||
{
|
||||
console.log("prevent");
|
||||
return; // Should do nothing if the default action has been cancelled
|
||||
@ -433,6 +434,7 @@ function postLoadPage()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Get algorithms list and load it.
|
||||
$.get( "/cgi-bin/getPluginsList.php",
|
||||
function( data )
|
||||
|
@ -93,6 +93,11 @@ FindConnectedComponentNew.prototype.getObjectSelectedGroup = function(object)
|
||||
return (object.id in this.selectedObjects) ? this.selectedObjects[object.id] : 0;
|
||||
}
|
||||
|
||||
FindConnectedComponentNew.prototype.getPriority = function()
|
||||
{
|
||||
return -9;
|
||||
}
|
||||
|
||||
|
||||
// Factory for connected components.
|
||||
function CreateConnectedComponetsNew(graph, app)
|
||||
|
@ -77,6 +77,11 @@ FindEulerianLoop.prototype.getObjectSelectedGroup = function(object)
|
||||
return (object.id in this.selectedObjects) ? this.selectedObjects[object.id] : 0;
|
||||
}
|
||||
|
||||
FindEulerianLoop.prototype.getPriority = function()
|
||||
{
|
||||
return -7;
|
||||
}
|
||||
|
||||
// Factory for connected components.
|
||||
function CreateFindEulerianLoop(graph, app)
|
||||
{
|
||||
|
84
script/plugins/NeedAlgorithm.js
Normal file
@ -0,0 +1,84 @@
|
||||
/**
|
||||
* Default handler.
|
||||
* Select using mouse, drag.
|
||||
*
|
||||
*/
|
||||
function NeedAlgorithm(graph, app)
|
||||
{
|
||||
BaseAlgorithm.apply(this, arguments);
|
||||
}
|
||||
|
||||
|
||||
// inheritance.
|
||||
NeedAlgorithm.prototype = Object.create(BaseAlgorithm.prototype);
|
||||
|
||||
|
||||
NeedAlgorithm.prototype.getName = function(local)
|
||||
{
|
||||
return local == "ru" ? "Не нашли нужный алгоритм?" : "Didn't find needed algorithm?";
|
||||
}
|
||||
|
||||
NeedAlgorithm.prototype.getId = function()
|
||||
{
|
||||
return "OlegSh.NeedAlgorithm";
|
||||
}
|
||||
|
||||
// @return message for user.
|
||||
NeedAlgorithm.prototype.getMessage = function(local)
|
||||
{
|
||||
return local == "ru" ? "Спасибо" : "Thank you";
|
||||
}
|
||||
|
||||
NeedAlgorithm.prototype.result = function(resultCallback)
|
||||
{
|
||||
var dialogButtons = {};
|
||||
|
||||
dialogButtons[g_send] = function() {
|
||||
console.log("Message" + $( "#NeedAlgorithmMessage" ).val());
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/cgi-bin/sendEmail.php?text=" + $( "#NeedAlgorithmMessage" ).val(),
|
||||
dataType: "text"
|
||||
});
|
||||
|
||||
$( this ).dialog( "close" );
|
||||
};
|
||||
|
||||
dialogButtons[g_close] = function() {
|
||||
$( this ).dialog( "close" );
|
||||
};
|
||||
|
||||
$( "#NeedAlgorithm" ).dialog({
|
||||
resizable: false,
|
||||
title: g_recommendAlgorithm,
|
||||
width: 400,
|
||||
modal: true,
|
||||
dialogClass: 'EdgeDialog',
|
||||
buttons: dialogButtons,
|
||||
});
|
||||
|
||||
var result = {};
|
||||
result["version"] = 1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NeedAlgorithm.prototype.getObjectSelectedGroup = function(object)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NeedAlgorithm.prototype.getPriority = function()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
|
||||
// Factory for connected components.
|
||||
function CreateNeedAlgorithm(graph, app)
|
||||
{
|
||||
return new NeedAlgorithm(graph)
|
||||
}
|
||||
|
||||
// Gerister connected component.
|
||||
RegisterAlgorithm (CreateNeedAlgorithm);
|
@ -199,7 +199,10 @@ FindShortPathNew.prototype.updateUpText = function()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FindShortPathNew.prototype.getPriority = function()
|
||||
{
|
||||
return -10;
|
||||
}
|
||||
|
||||
|
||||
// Factory for connected components.
|
||||
|
@ -68,6 +68,8 @@ var g_noWeight = "No weight";
|
||||
var g_groupRename = "Group rename";
|
||||
var g_vote = "Vote";
|
||||
|
||||
var g_recommendAlgorithm = "Recommend algorithm";
|
||||
|
||||
function loadTexts()
|
||||
{
|
||||
g_textsSelectAndMove = document.getElementById("SelectAndMoveObject").innerHTML;
|
||||
@ -135,4 +137,6 @@ function loadTexts()
|
||||
g_noWeight = document.getElementById("noWeight").innerHTML;
|
||||
g_groupRename = document.getElementById("groupeRenameText").innerHTML;
|
||||
g_vote = document.getElementById("voteText").innerHTML;
|
||||
|
||||
g_recommendAlgorithm = document.getElementById("recommend_algorithm").innerHTML;
|
||||
}
|
||||
|
12
tpl/home.php
@ -304,6 +304,16 @@
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="NeedAlgorithm">
|
||||
<form>
|
||||
<fieldset>
|
||||
<p><?= L('what_algorithm_need') ?></p>
|
||||
<textarea name="needAlgorthmText" id="NeedAlgorithmMessage" rows="5"></textarea>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p id="SelectAndMoveObject" class="translation"><?= L('select_and_move_objects')?></p>
|
||||
<p id="MoveCursorForMoving" class="translation"><?= L('move_cursor_for_moving')?></p>
|
||||
@ -370,6 +380,8 @@
|
||||
<p id="noWeight" class="translation"><?= L('default_weight')?></p>
|
||||
<p id="groupeRenameText" class="translation"><?= L('group_rename')?></p>
|
||||
<p id="voteText" class="translation"><?= L('vote')?></p>
|
||||
<p id="recommend_algorithm" class="translation"><?= L('recommend_algorithm')?></p>
|
||||
|
||||
|
||||
</section>
|
||||
<!--
|
||||
|