llTextBox, patch from Henri

This commit is contained in:
Siana Gearz
2011-02-06 18:38:51 +01:00
parent 144f8d720a
commit 3a4093ccc3
4 changed files with 80 additions and 9 deletions

View File

@@ -6252,6 +6252,10 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response)
// Didn't click "Ignore"
if (button_idx != -1)
{
if (notification["payload"].has("textbox"))
{
button = response["message"].asString();
}
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("ScriptDialogReply");
msg->nextBlock("AgentData");
@@ -6307,12 +6311,30 @@ void process_script_dialog(LLMessageSystem* msg, void**)
}
LLNotificationForm form;
for (i = 0; i < button_count; i++)
std::string firstbutton;
msg->getString("Buttons", "ButtonLabel", firstbutton, 0);
form.addElement("button", std::string(firstbutton));
bool is_text_box = false;
std::string default_text;
if (firstbutton == "!!llTextBox!!")
{
is_text_box = true;
for (i = 1; i < button_count; i++)
{
std::string tdesc;
msg->getString("Buttons", "ButtonLabel", tdesc, i);
default_text += tdesc;
}
}
else
{
for (i = 1; i < button_count; i++)
{
std::string tdesc;
msg->getString("Buttons", "ButtonLabel", tdesc, i);
form.addElement("button", std::string(tdesc));
}
}
LLSD args;
args["TITLE"] = title;
@@ -6325,9 +6347,19 @@ void process_script_dialog(LLMessageSystem* msg, void**)
{
args["FIRST"] = first_name;
args["LAST"] = last_name;
if (is_text_box)
{
args["DEFAULT"] = default_text;
payload["textbox"] = "true";
LLNotifications::instance().add("ScriptTextBoxDialog", args, payload, callback_script_dialog);
}
else
{
notification = LLNotifications::instance().add(
LLNotification::Params("ScriptDialog").substitutions(args).payload(payload).form_elements(form.asLLSD()));
}
}
else
{
args["GROUPNAME"] = last_name;