@verb #84:"edit_prop" this none this rxdo #789 @program #84:"edit_prop" this none this caller == this || raise(E_PERM) player:isa($webber) || raise(E_PERM) player:tell($eval.antistealth) set_task_perms(player.user) {get, object} = args if (iobj && player.referer && $www:previous_object() != object && player.user != $no_one) "We have an unknown form refering a command to us with a user's perms..." $msg:mtell("www_error", "Warning! Previous page doesn't appear to be this one!") player:tell("For security reasons the command will not be executed. Refering page: [", player.referer, "]") iobj = {} endif host = `object:property_location(get)[1] ! E_TYPE => E_PROPNF' suspend(0) url = tostr("/", toint(object)) name = get info = `property_info(object, get) ! E_PERM, E_PROPNF' if (info == E_PERM) $msg:mtell("www_error", "You do not have permission to view this property.") return $www.exam:tell_props(object) elseif (info == E_PROPNF) if ($www:parse_POST("create")) "Prop doesn't exist, and we want to create it." try add_property(object, get, 0, {player.user, "rc"}) except (E_PERM) player:tell("Property not created. This may be because you are over-quota.
") return endtry player:tell("Property created!
") "Keep going, and show the edit page." host = object post = "" info = property_info(object, get) else "Prop doesn't exist, offer to create it." player:tell("", object:nn(), " doesn't have this property.
") if ($perm_utils:controls(player.user, object) || (object.w && player.user != $no_one)) player:tell("

") endif inherited = 0 for x in ({object, @object:ancestors()}) inherited = inherited + length(`properties(x) ! E_PERM => {}') endfor return player:tell("See the list of ", `length(properties(object)) ! E_PERM => "?"', " defined props and ", inherited, " inherited props on ", $su:nn(object), ".") endif elseif ($www:parse_POST("clear")) "Clear the prop." if (`clear_property(object, get) ! E_PERM' == E_PERM) $msg:mtell("www_error", "You do not have permission to clear this property.") else player:tell("", object, ".", $html_utils:literal_text(get), " has been cleared!
") endif elseif ($www:parse_POST("delete") == "Delete prop") "Unconfirmed request to delete prop (probably no JavaScript)." player:tell("Are you sure you want to delete this property?
") player:tell("

") return elseif ($www:parse_POST("delete")) "Delete the prop, then show the list of props." if (`delete_property(object, get) ! E_PERM' == E_PERM) $msg:mtell("www_error", "You do not have permission to delete this property.") else player:tell("", object, ".", $html_utils:literal_text(get), " has been deleted!
") return $www.exam:tell_props(object) endif elseif (iobj) "Save the property." if ($www:parse_POST("create")) $msg:mtell("www_error", "Property already exists!") elseif (this.sharing_violations && $www:parse_POST("hash") && this:hash(tostr(object, ".", get)) != $www:parse_POST("hash")) $msg:mtell("www_error", "Sharing violation!") player:tell("While you were in the editor, somebody/something changed this property. You have two choices: you can either lose your changes or you can lose the other person's changes.

") player:tell("

") player:tell($html_utils:input_hidden("hash", "")) for x in (iobj) if (x[1] != "hash") player:tell($html_utils:input_hidden(@x)) endif endfor player:tell("It might be wise to see what the property looks like now and determine if you want to redo your changes on the new version, or come back here and the new version with your changes.
") player:tell("

How did this happen?

") return elseif (!$set_utils:includes($list_utils:slice(iobj), {"hash", "rename", "data", "mode"})) $msg:mtell("www_error", "Invalid form elements.") player:tell("Property was not saved due to an error in the web interface. Tell a wizard.
") else name = $www:parse_POST("rename") data = $www:parse_POST("data") mode = $www:parse_POST("mode") mods = ($www:parse_POST("r") ? "r" | "") + ($www:parse_POST("w") ? "w" | "") + ($www:parse_POST("c") ? "c" | "") if (mode == "value") result = $string_utils:to_value(typeof(data) == $LIST ? $string_utils:from_list(data) | data) if (result[1]) data = result[2] else $msg:mtell("www_error", "Could not parse value!") if (typeof(result[2]) == $ERR) player:tell("Evaluation error: ", result[2], "") else player:tell("Syntax error: ", $su:from_list(result[2], "
"), "
") endif if (typeof(data) == $STR) data = {data} endif