From 6c0e5b60853210d4bd65789a53b0a087cd26d512 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Thu, 11 Jun 2009 17:54:01 +0000 Subject: [PATCH] * templatize iconbar editing --- webcit/iconbar.c | 308 +----------------------------- webcit/static/t/head.html | 4 +- webcit/static/t/iconbar.html | 2 +- webcit/static/t/iconbar_edit.html | 99 ++++++++++ 4 files changed, 109 insertions(+), 304 deletions(-) create mode 100644 webcit/static/t/iconbar_edit.html diff --git a/webcit/iconbar.c b/webcit/iconbar.c index 532dfbdee..3ed1e38be 100644 --- a/webcit/iconbar.c +++ b/webcit/iconbar.c @@ -17,7 +17,7 @@ void DontDeleteThis(void *Data){} long IconbarIsENABLED(const char *key, size_t keylen, long defval) { - void *Data; + void *Data = NULL; wcsession *WCC = WC; if (WCC == NULL) @@ -26,8 +26,7 @@ long IconbarIsENABLED(const char *key, size_t keylen, long defval) if (GetHash(WCC->IconBarSettings, key, keylen, - &Data) && - (Data != NULL)) + &Data)) return (long) Data; else return defval; @@ -76,7 +75,7 @@ int ConditionalIsActiveStylesheet(StrBuf *Target, WCTemplputParams *TP) { int ib_displayas; testFor = GetTemplateTokenNumber(Target, TP, 3, IB_PICTEXT); - ib_displayas = IconbarIsEnabled("ib_displayas", IB_PICTEXT); + ib_displayas = IconbarIsENABLED(TKEY(2),0); return (testFor == ib_displayas); } @@ -117,292 +116,12 @@ void LoadIconSettings(StrBuf *iconbar, long lvalue) FreeStrBuf(&buf); } -/* - * display a customized version of the iconbar - */ -void display_customize_iconbar(void) { - int i; - int bar = 0; - long val; - - int ib_displayas; - - output_headers(1, 1, 2, 0, 0, 0); - wprintf("
"); - wprintf("

"); - wprintf(_("Customize the icon bar")); - wprintf("

\n"); - - wprintf("
\n"); - - wprintf("
"); - - wprintf("
\n"); - wprintf("\n", WC->nonce); - - wprintf("\n"); - wprintf("\n"); - - bar = 1 - bar; - val = IconbarIsEnabled("ib_logo", 0); - wprintf("\n", - (bar ? "even" : "odd"), - (val ? "CHECKED" : ""),_("Yes"), - (!val ? "CHECKED" : ""),_("No"), - _("Site logo"), - _("An icon describing this site") - ); - - bar = 1 - bar; - val = IconbarIsEnabled("ib_summary", 1); - wprintf("\n", - (bar ? "even" : "odd"), - (val ? "CHECKED" : ""),_("Yes"), - (!val ? "CHECKED" : ""),_("No"), - _("Summary"), - _("Your summary page") - ); - - bar = 1 - bar; - val = IconbarIsEnabled("ib_inbox", 1); - wprintf("\n", - (bar ? "even" : "odd"), - (val ? "CHECKED" : ""),_("Yes"), - (!val ? "CHECKED" : ""),_("No"), - _("Mail (inbox)"), - _("A shortcut to your email Inbox") - ); - - bar = 1 - bar; - val = IconbarIsEnabled("ib_contacts", 1); - wprintf("\n", - (bar ? "even" : "odd"), - (val ? "CHECKED" : ""),_("Yes"), - (!val ? "CHECKED" : ""),_("No"), - _("Contacts"), - _("Your personal address book") - ); - - bar = 1 - bar; - val = IconbarIsEnabled("ib_notes", 1); - wprintf("\n", - (bar ? "even" : "odd"), - (val ? "CHECKED" : ""),_("Yes"), - (!val ? "CHECKED" : ""),_("No"), - _("Notes"), - _("Your personal notes") - ); - - bar = 1 - bar; - val = IconbarIsEnabled("ib_calendar", 1); - wprintf("\n", - (bar ? "even" : "odd"), - (val ? "CHECKED" : ""),_("Yes"), - (!val ? "CHECKED" : ""),_("No"), - _("Calendar"), - _("A shortcut to your personal calendar") - ); - - bar = 1 - bar; - val = IconbarIsEnabled("ib_tasks", 1); - wprintf("\n", - (bar ? "even" : "odd"), - (val ? "CHECKED" : ""),_("Yes"), - (!val ? "CHECKED" : ""),_("No"), - _("Tasks"), - _("A shortcut to your personal task list") - ); - - bar = 1 - bar; - val = IconbarIsEnabled("ib_rooms", 1); - wprintf("\n", - (bar ? "even" : "odd"), - (val ? "CHECKED" : ""),_("Yes"), - (!val ? "CHECKED" : ""),_("No"), - _("Rooms"), - _("Clicking this icon displays a list of all accessible " - "rooms (or folders) available.") - ); - - bar = 1 - bar; - val = IconbarIsEnabled("ib_users", 1); - wprintf("\n", - (bar ? "even" : "odd"), - (val ? "CHECKED" : ""),_("Yes"), - (!val ? "CHECKED" : ""),_("No"), - ((val > 1) ? "CHECKED" : ""),_("Yes with users list"), - _("Who is online?"), - _("Clicking this icon displays a list of all users " - "currently logged in.") - ); - - bar = 1 - bar; - val = IconbarIsEnabled("ib_chat", 1); - wprintf("\n", - (bar ? "even" : "odd"), - (val ? "CHECKED" : ""),_("Yes"), - (!val ? "CHECKED" : ""),_("No"), - _("Chat"), - _("Clicking this icon enters real-time chat mode " - "with other users in the same room.") - - ); - - bar = 1 - bar; - val = IconbarIsEnabled("ib_advanced", 1); - wprintf("\n", - (bar ? "even" : "odd"), - (val ? "CHECKED" : ""),_("Yes"), - (!val ? "CHECKED" : ""),_("No"), - _("Advanced options"), - _("Access to the complete menu of Citadel functions.") - - ); - - bar = 1 - bar; - val = IconbarIsEnabled("ib_citadel", 1); - wprintf("\n", - (bar ? "even" : "odd"), - (val ? "CHECKED" : ""),_("Yes"), - (!val ? "CHECKED" : ""),_("No"), - _("Citadel logo"), - _("Displays the 'Powered by Citadel' icon") - ); - - wprintf("
"); - wprintf(_("Display icons as:")); - wprintf(""); - ib_displayas = IconbarIsEnabled("ib_displayas",IB_PICTEXT); - for (i=0; i<=2; ++i) { - wprintf(""); - if (i == IB_PICTEXT) wprintf(_("pictures and text")); - if (i == IB_PICONLY) wprintf(_("pictures only")); - if (i == IB_TEXTONLY) wprintf(_("text only")); - wprintf("\n"); - } - wprintf("
\n"); - - wprintf(_("Select the icons you would like to see displayed " - "in the 'icon bar' menu on the left side of the " - "screen.")); - wprintf("
" - " %s    " - " %s
" - "
" - "\" \"" - "" - "%s
" - "%s" - "
" - " %s    " - " %s
" - "
" - "\" \"" - "" - "%s
" - "%s" - "
" - " %s    " - " %s
" - "
" - "\" \"" - "" - "%s
" - "%s" - "
" - " %s    " - " %s
" - "
" - "\" \"" - "" - "%s
" - "%s" - "
" - " %s    " - " %s
" - "
" - "\" \"" - "" - "%s
" - "%s" - "
" - " %s    " - " %s
" - "
" - "\" \"" - "" - "%s
" - "%s" - "
" - " %s    " - " %s
" - "
" - "\" \"" - "" - "%s
" - "%s" - "
" - " %s    " - " %s
" - "
" - "\" \"" - "" - "%s
" - "%s" - "
" - " %s    " - " %s
" - " %s" - "
" - "\" \"" - "" - "%s" - "
%s" - "
" - " %s    " - " %s
" - "
" - "\" \"" - "" - "%s
" - "%s" - "
" - " %s    " - " %s
" - "
" - "\" \"" - "" - "%s
" - "%s" - "
" - " %s    " - " %s
" - "
" - "\" \"" - "" - "%s
" - "%s" - "

\n" - "
" - "" - " " - "" - "
\n", - _("Save changes"), - _("Cancel") - ); - - wprintf("
\n"); - wDumpContent(2); -} /* * save changes to iconbar settings */ void commit_iconbar(void) { + const StrBuf *MimeType; StrBuf *iconbar; StrBuf *buf; int i; @@ -449,22 +168,10 @@ void commit_iconbar(void) { FreeStrBuf(&buf); set_preference("iconbar", iconbar, 1); - output_headers(1, 1, 2, 0, 0, 0); - /* TODO: TEMPLATE */ - wprintf("
\n"); - wprintf("

"); - wprintf(_("Customize the icon bar")); - wprintf("

\n"); - wprintf("
\n"); - wprintf( - "
" - "" - " "); - wprintf(_("Your icon bar has been updated. Please select any of its " - "choices to continue.
You may need to force refresh (SHIFT-F5) in order for changes to take effect")); - wprintf("
\n"); - wDumpContent(2); + begin_burst(); + MimeType = DoTemplate(HKEY("iconbar_save"), NULL, &NoCtx); + http_transmit_thing(ChrPtr(MimeType), 0); #ifdef DBG_ICONBAR_HASH dbg_PrintHash(WC->IconBarSetttings, PrintInt, NULL); #endif @@ -487,7 +194,6 @@ InitModule_ICONBAR WebcitAddUrlHandler(HKEY("user_iconbar"), doUserIconStylesheet, 0); WebcitAddUrlHandler(HKEY("commit_iconbar"), commit_iconbar, 0); RegisterConditional(HKEY("COND:ICONBAR:ACTIVE"), 3, ConditionalIsActiveStylesheet, CTX_NONE); - WebcitAddUrlHandler(HKEY("display_customize_iconbar"), display_customize_iconbar, 0); RegisterNamespace("ICONBAR", 0, 0, tmplput_iconbar, 0); RegisterPreference("iconbar", _("Iconbar Setting"), PRF_STRING, LoadIconSettings); diff --git a/webcit/static/t/head.html b/webcit/static/t/head.html index 609791a97..4b7547d52 100644 --- a/webcit/static/t/head.html +++ b/webcit/static/t/head.html @@ -12,8 +12,8 @@ -stylesheet" type="text/css" id="style_iconbar_icns" title="Default iconbar"> -stylesheet" type="text/css" id="style_iconbar_piconly" title="Iconbar without text"> +stylesheet" type="text/css" id="style_iconbar_icns" title="Default iconbar"> +stylesheet" type="text/css" id="style_iconbar_piconly" title="Iconbar without text"> diff --git a/webcit/static/t/iconbar.html b/webcit/static/t/iconbar.html index d048d4a4f..038057cad 100644 --- a/webcit/static/t/iconbar.html +++ b/webcit/static/t/iconbar.html @@ -77,7 +77,7 @@ title="">
- +
diff --git a/webcit/static/t/iconbar_edit.html b/webcit/static/t/iconbar_edit.html new file mode 100644 index 000000000..883885da0 --- /dev/null +++ b/webcit/static/t/iconbar_edit.html @@ -0,0 +1,99 @@ + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +"> +"> +"> +
+ +
+>     +>
+
  +
+>     +>
+
  +
+>     +>
+
  +
+>     +>
+
  +
+>     +>
+
  +
+>     +>
+
  +
+>     +>
+
  +
+>     +>
+
  +
+>     +>
+>
+  +
+>     +>
+
  +
+>     +>
+
  +
+>     +>
+
  +

+ +
"> ">
+ +
+ -- 2.30.2