[mythtv] [PATCH] Server Status Episode Descriptions

Brett Lucey brett at happykoala.com
Mon Nov 17 18:11:09 EST 2003


Here's the latest with the patch.  Basically, instead of trying to pass the
description as part of a javascript call inside of a URL, I made hidden
fields and just pass the index of the fields to grab from.

I've tested this in IE and it works great.  If someone could let me know if
there are any issues in other browsers, I would appreciate it.  Barring
that, this should work perfect.

-Brett


Index: programs/mythbackend/mainserver.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/mainserver.cpp,v
retrieving revision 1.92
diff -u -r1.92 mainserver.cpp
--- programs/mythbackend/mainserver.cpp 16 Nov 2003 01:11:50 -0000      1.92
+++ programs/mythbackend/mainserver.cpp 17 Nov 2003 23:06:59 -0000
@@ -6,6 +6,7 @@
 #include <qurl.h>
 #include <qthread.h>
 #include <qwaitcondition.h>
+#include <qregexp.h>

 #include <unistd.h>
 #include <stdlib.h>
@@ -2449,10 +2450,27 @@
     }
     else
     {
+
        os << "<P>The next " << iNum << " show" << (iNum == 1 ? "" : "s" )
           << " that " << (iNum == 1 ? "is" : "are")
           << " scheduled for recording:<BR>\r\n";

+       os << "<Script language=JavaScript>";
+       os << "function dispDesc(i) {\r\n";
+       os << "wnd=window.open(\"\", \"\",\"width=250 height=180\");";
+       os << "wnd.document.write(\"<font face=arial size=+1><b>\");";
+       os << "wnd.document.write("
+            << "document.forms['Desc'].elements['title_' + i].value);";
+       os << "wnd.document.write(\"</b></font><br><br>\");";
+       os << "wnd.document.write(\"<font face=helvetica size=-1>\");";
+       os << "wnd.document.write("
+            << "document.forms['Desc'].elements['desc_' + i].value);";
+       os << "wnd.document.write(\"</font>\");";
+       os << "}";
+       os << "</script>";
+
+       os << "<form name=\"Desc\">\r\n";
+
        os << "<TABLE BORDER WIDTH=80%>\r\n";
        os << "<TR><TH>Start
Time</TH><TH>Show</TH><TH>Encoder</TH></TR>\r\n";
        list<ProgramInfo *>::iterator iter = recordinglist->begin();
@@ -2466,14 +2484,25 @@
            }
            else
            {
+               QString qstrTitle = ((*iter)->title).replace(
+                  QRegExp("\""), "&quot;");
+               QString qstrDescription = ((*iter)->description).replace(
+                  QRegExp("\""), "&quot;");
+
+
                os << "<TR " << ((i % 2 == 0) ? "BGCOLOR=EEEEEE" : "") <<
">"
                   << "<TD>" <<
((*iter)->recstartts).toString(shortdateformat)
                   << " " << ((*iter)->recstartts).toString(timeformat) <<
"</TD>"
-                  << "<TD>" << (*iter)->title << "</TD>"
+                  << "<TD><input type=\"hidden\" name=\"desc_" << i << "\""
+                        << "value=\"" << qstrDescription << "\">"
+                        << "<input type=\"hidden\" name=\"title_" << i <<
"\""
+                        << "value=\"" << qstrTitle << "\">"
+                        << "<a href=\"javascript:dispDesc('" << i <<
"')\">"
+                  << (*iter)->title << "</a></TD>"
                   << "<TD>" << (*iter)->cardid << "</TD></TR>\r\n";
            }
        }
        os << "</TABLE>";
+       os << "</form>";
     }

     delete sched;



More information about the mythtv-dev mailing list