<%pre> #include #include #include #include "exception.h" #include "tools.h" #include "epg_events.h" #include "recman.h" #include "setup.h" #include "i18n.h" #include "livefeatures.h" #include "users.h" using namespace std; using namespace vdrlive; <%args> // input parameters string recid; string async; // form parameters string name = ""; string directory = ""; string options[]; <%session scope="global"> bool logged_in(false); string edit_rec_referer; <%request scope="page"> const cRecording* recording; <%include>page_init.eh <%cpp> if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); if (!cUser::CurrentUserHasRightTo(UR_EDITRECS)) throw HtmlError( tr("Sorry, no permission. Please contact your administrator!") ); bool ajaxReq = !async.empty() && (lexical_cast(async) != 0); string message; recording = NULL; if (!recid.empty()) { recording = LiveRecordingsManager()->GetByMd5Hash(recid); if (!recording) throw HtmlError(tr("Couldn't find recording. Maybe you mistyped your request?")); } if (request.getMethod() == "POST") { if (name.empty()) message = tr("Please set a name for the recording!"); else if (recording) { bool copy_only = false; for (options_type::const_iterator it = options.begin(); it != options.end(); ++it) { if (*it == "delresume") LiveRecordingsManager()->DeleteResume(recording); else if (*it == "delmarks") LiveRecordingsManager()->DeleteMarks(recording); else if (*it == "copy") copy_only = true; } options.clear(); string filename = directory.empty() ? name : StringReplace(directory, "/", "~") + "~" + name; if (LiveRecordingsManager()->MoveRecording(recording, FileSystemExchangeChars(filename, true), copy_only)) return reply.redirect(!edit_rec_referer.empty() ? edit_rec_referer : "recordings.html"); else message = tr("Cannot copy, rename or move the recording."); } } if (message.empty()) edit_rec_referer = request.getHeader("Referer:", "recordings.html"); if (recording) { string path = recording->Name(); size_t found = path.find_last_of("~"); if (found != string::npos) { directory = StringReplace(path.substr(0, found), "~", "/"); name = path.substr(found + 1); } else { directory = ""; name = path; } } <& pageelems.doc_type &> VDR Live - <$ tr("Edit recording") $> <%cpp> if (!ajaxReq) { <& pageelems.stylesheets &> <& pageelems.ajax_js &> <%cpp> } <%cpp> if (!ajaxReq) { <& pageelems.logo &> <& menu active=("recordings") &> <%cpp> }
<%cpp> if (recording && recording->Info()->ShortText()) { <%cpp> } if (recording && recording->Info()->Description()) { <%cpp> } if (recording && recording->Info()->Aux()) { <%cpp> }
<$ tr("Edit recording") $>
<$ tr("Name") $>:
<$ tr("Directory") $>:
<$ tr("Delete resume information") $>:
<$ tr("Delete marks information") $>:
<$ tr("Copy only") $>:
<$ tr("Short description") $>:
<$ recording->Info()->ShortText() $>
<$ tr("Description") $>:
<$ recording->Info()->Description() $>
<$ tr("Auxiliary info") $>:
<$ recording->Info()->Aux() $>
<$ message $>
<%include>page_exit.eh