Fossil SCM
More initialization and diff options for skin editing.
Commit
c6ee75a912be27491cdc47bd71258960a6f4156e618faaf783e58f5bda92914b
Parent
205a748ed53b0e8…
1 file changed
+87
-46
+87
-46
| --- src/skins.c | ||
| +++ src/skins.c | ||
| @@ -619,10 +619,69 @@ | ||
| 619 | 619 | |
| 620 | 620 | @ </table> |
| 621 | 621 | style_footer(); |
| 622 | 622 | db_end_transaction(0); |
| 623 | 623 | } |
| 624 | + | |
| 625 | +/* | |
| 626 | +** Generate HTML for a <select> that lists all the available skin names, | |
| 627 | +** except for zExcept if zExcept!=NULL. | |
| 628 | +*/ | |
| 629 | +static void skin_emit_skin_selector( | |
| 630 | + const char *zVarName, /* Variable name for the <select> */ | |
| 631 | + const char *zDefault, /* The default value, if not NULL */ | |
| 632 | + const char *zExcept /* Omit this skin if not NULL */ | |
| 633 | +){ | |
| 634 | + int i; | |
| 635 | + @ <select size='1' name='%s(zVarName)'> | |
| 636 | + if( fossil_strcmp(zExcept, "current")!=0 ){ | |
| 637 | + @ <option value='current'>Currently In Use</option> | |
| 638 | + } | |
| 639 | + for(i=0; i<count(aBuiltinSkin); i++){ | |
| 640 | + const char *zName = aBuiltinSkin[i].zLabel; | |
| 641 | + if( fossil_strcmp(zName, zExcept)==0 ) continue; | |
| 642 | + if( fossil_strcmp(zDefault, zName)==0 ){ | |
| 643 | + @ <option value='%s(zName)' selected>\ | |
| 644 | + @ %h(aBuiltinSkin[i].zDesc) (built-in)</option> | |
| 645 | + }else{ | |
| 646 | + @ <option value='%s(zName)'>\ | |
| 647 | + @ %h(aBuiltinSkin[i].zDesc) (built-in)</option> | |
| 648 | + } | |
| 649 | + } | |
| 650 | + for(i=1; i<=9; i++){ | |
| 651 | + char zName[20]; | |
| 652 | + sqlite3_snprintf(sizeof(zName), zName, "draft%d", i); | |
| 653 | + if( fossil_strcmp(zName, zExcept)==0 ) continue; | |
| 654 | + if( fossil_strcmp(zDefault, zName)==0 ){ | |
| 655 | + @ <option value='%s(zName)' selected>%s(zName)</option> | |
| 656 | + }else{ | |
| 657 | + @ <option value='%s(zName)'>%s(zName)</option> | |
| 658 | + } | |
| 659 | + } | |
| 660 | + @ </select> | |
| 661 | +} | |
| 662 | + | |
| 663 | +/* | |
| 664 | +** Return the text of one of the skin files. | |
| 665 | +*/ | |
| 666 | +static const char *skin_file_content(const char *zLabel, const char *zFile){ | |
| 667 | + const char *zResult; | |
| 668 | + if( fossil_strcmp(zLabel, "current")==0 ){ | |
| 669 | + zResult = db_get(zFile, ""); | |
| 670 | + }else if( sqlite3_strglob("draft[1-9]", zLabel)==0 ){ | |
| 671 | + zResult = db_get_mprintf("%s-%s", "", zLabel, zFile); | |
| 672 | + }else{ | |
| 673 | + while( 1 ){ | |
| 674 | + char *zKey = mprintf("skins/%s/%s.txt", zLabel, zFile); | |
| 675 | + zResult = builtin_text(zKey); | |
| 676 | + fossil_free(zKey); | |
| 677 | + if( zResult!=0 || fossil_strcmp(zLabel,"default")==0 ) break; | |
| 678 | + } | |
| 679 | + } | |
| 680 | + return zResult; | |
| 681 | +} | |
| 682 | + | |
| 624 | 683 | |
| 625 | 684 | /* |
| 626 | 685 | ** WEBPAGE: setup_skinedit |
| 627 | 686 | ** |
| 628 | 687 | ** Edit aspects of a skin determined by the w= query parameter. |
| @@ -640,18 +699,19 @@ | ||
| 640 | 699 | /* 0 */ { "css", "CSS", "CSS", }, |
| 641 | 700 | /* 1 */ { "footer", "Page Footer", "Footer", }, |
| 642 | 701 | /* 2 */ { "header", "Page Header", "Header", }, |
| 643 | 702 | /* 3 */ { "details", "Display Details", "Details", }, |
| 644 | 703 | }; |
| 645 | - const char *zBasis; | |
| 646 | - const char *zContent; | |
| 647 | - char *zDflt; | |
| 648 | - char *zKey; | |
| 649 | - char *zTitle; | |
| 650 | - int iSkin; | |
| 651 | - int ii; | |
| 652 | - int j; | |
| 704 | + const char *zBasis; /* The baseline file */ | |
| 705 | + const char *zContent; /* Content after editing */ | |
| 706 | + char *zDraft; /* Which draft: "draft%d" */ | |
| 707 | + char *zKey; /* CONFIG table key name: "draft%d-%s" */ | |
| 708 | + char *zTitle; /* Title of this page */ | |
| 709 | + const char *zFile; /* One of "css", "footer", "header", "details" */ | |
| 710 | + int iSkin; /* draft number. 1..9 */ | |
| 711 | + int ii; /* Index in aSkinAttr[] of this file */ | |
| 712 | + int j; /* Loop counter */ | |
| 653 | 713 | |
| 654 | 714 | login_check_credentials(); |
| 655 | 715 | |
| 656 | 716 | /* Figure out which skin we are editing */ |
| 657 | 717 | iSkin = atoi(PD("sk","1")); |
| @@ -672,15 +732,16 @@ | ||
| 672 | 732 | } |
| 673 | 733 | |
| 674 | 734 | /* figure out which file is to be edited */ |
| 675 | 735 | ii = atoi(PD("w","0")); |
| 676 | 736 | if( ii<0 || ii>count(aSkinAttr) ) ii = 0; |
| 677 | - zKey = mprintf("draft%d-%s", iSkin, aSkinAttr[ii].zFile); | |
| 737 | + zFile = aSkinAttr[ii].zFile; | |
| 738 | + zDraft = mprintf("draft%d", iSkin); | |
| 739 | + zKey = mprintf("draft%d-%s", iSkin, zFile); | |
| 678 | 740 | zTitle = mprintf("%s for Draft%d", aSkinAttr[ii].zTitle, iSkin); |
| 741 | + zBasis = PD("basis","current"); | |
| 679 | 742 | |
| 680 | - zBasis = PD("basis","default"); | |
| 681 | - zDflt = mprintf("skins/%s/%s.txt", zBasis, aSkinAttr[ii].zFile); | |
| 682 | 743 | db_begin_transaction(); |
| 683 | 744 | style_header("%s", zTitle); |
| 684 | 745 | for(j=0; j<count(aSkinAttr); j++){ |
| 685 | 746 | if( j==ii ) continue; |
| 686 | 747 | style_submenu_element(aSkinAttr[j].zSubmenu, |
| @@ -689,31 +750,30 @@ | ||
| 689 | 750 | @ <form action="%s(g.zTop)/setup_skinedit" method="post"><div> |
| 690 | 751 | login_insert_csrf_secret(); |
| 691 | 752 | @ <input type='hidden' name='w' value='%d(ii)'> |
| 692 | 753 | @ <input type='hidden' name='sk' value='%d(iSkin)'> |
| 693 | 754 | @ <h2>Edit %s(zTitle):</h2> |
| 694 | - zContent = textarea_attribute("", 10, 80, zKey, | |
| 695 | - aSkinAttr[ii].zFile, builtin_text(zDflt), 0); | |
| 755 | + zContent = textarea_attribute( | |
| 756 | + "", /* Text label */ | |
| 757 | + 10, 80, /* Height and width of the edit area */ | |
| 758 | + zKey, /* Name of CONFIG table entry */ | |
| 759 | + zFile, /* CGI query parameter name */ | |
| 760 | + skin_file_content(zBasis, zFile), /* Default value of the text */ | |
| 761 | + 0 /* Disabled flag */ | |
| 762 | + ); | |
| 696 | 763 | @ <br /> |
| 697 | 764 | @ <input type="submit" name="submit" value="Apply Changes" /> |
| 698 | 765 | @ <hr /> |
| 699 | - @ Baseline: <select size='1' name='basis'> | |
| 700 | - for(j=0; j<count(aBuiltinSkin); j++){ | |
| 701 | - cgi_printf("<option value='%h'%s>%h</option>\n", | |
| 702 | - aBuiltinSkin[j].zLabel, | |
| 703 | - fossil_strcmp(zBasis,aBuiltinSkin[j].zLabel)==0 ? " selected" : "", | |
| 704 | - aBuiltinSkin[j].zDesc | |
| 705 | - ); | |
| 706 | - } | |
| 707 | - @ </select> | |
| 766 | + @ Baseline: \ | |
| 767 | + skin_emit_skin_selector("basis", zBasis, zDraft); | |
| 708 | 768 | @ <input type="submit" name="diff" value="Diff" /> |
| 709 | 769 | if( P("diff")!=0 ){ |
| 710 | 770 | u64 diffFlags = construct_diff_flags(0,0) | |
| 711 | 771 | DIFF_STRIP_EOLCR; |
| 712 | 772 | Blob from, to, out; |
| 713 | 773 | blob_init(&to, zContent, -1); |
| 714 | - blob_init(&from, builtin_text(zDflt), -1); | |
| 774 | + blob_init(&from, skin_file_content(zBasis, zFile), -1); | |
| 715 | 775 | blob_zero(&out); |
| 716 | 776 | if( diffFlags & DIFF_SIDEBYSIDE ){ |
| 717 | 777 | text_diff(&from, &to, &out, 0, diffFlags | DIFF_HTML | DIFF_NOTTOOBIG); |
| 718 | 778 | @ %s(blob_str(&out)) |
| 719 | 779 | }else{ |
| @@ -737,26 +797,13 @@ | ||
| 737 | 797 | ** skin named by zTemplate. |
| 738 | 798 | */ |
| 739 | 799 | static void skin_initialize_draft(int iSkin, const char *zTemplate){ |
| 740 | 800 | int i; |
| 741 | 801 | if( zTemplate==0 ) return; |
| 742 | - if( strcmp(zTemplate, "current")==0 ){ | |
| 743 | - for(i=0; i<count(azSkinFile); i++){ | |
| 744 | - db_set_mprintf("draft%d-%s", db_get(azSkinFile[i],""), 0, | |
| 745 | - iSkin, azSkinFile[i]); | |
| 746 | - } | |
| 747 | - return; | |
| 748 | - } | |
| 749 | - for(i=0; i<count(aBuiltinSkin); i++){ | |
| 750 | - if( strcmp(zTemplate, aBuiltinSkin[i].zLabel)==0 ){ | |
| 751 | - for(i=0; i<count(azSkinFile); i++){ | |
| 752 | - char *zKey = mprintf("skins/%s/%s.txt", zTemplate, azSkinFile[i]); | |
| 753 | - db_set_mprintf("draft%d-%s", builtin_text(zKey), 0, | |
| 754 | - iSkin, azSkinFile[i]); | |
| 755 | - } | |
| 756 | - return; | |
| 757 | - } | |
| 802 | + for(i=0; i<count(azSkinFile); i++){ | |
| 803 | + const char *z = skin_file_content(zTemplate, azSkinFile[i]); | |
| 804 | + db_set_mprintf("draft%d-%s", z, 0, iSkin, azSkinFile[i]); | |
| 758 | 805 | } |
| 759 | 806 | } |
| 760 | 807 | |
| 761 | 808 | /* |
| 762 | 809 | ** Publish the draft skin iSkin as the new default. |
| @@ -920,17 +967,11 @@ | ||
| 920 | 967 | @ |
| 921 | 968 | @ <form method='POST' action='%R/setup_skin#step4' id='f03'> |
| 922 | 969 | @ <p class='skinInput'> |
| 923 | 970 | @ <input type='hidden' name='sk' value='%d(iSkin)'> |
| 924 | 971 | @ Initialize skin <b>draft%d(iSkin)</b> using |
| 925 | - @ <select size='1' name='initskin'> | |
| 926 | - @ <option value='current'>Currently In Use</option> | |
| 927 | - for(i=0; i<count(aBuiltinSkin); i++){ | |
| 928 | - @ <option value='%s(aBuiltinSkin[i].zLabel)'>\ | |
| 929 | - @ %h(aBuiltinSkin[i].zDesc) (built-in)</option> | |
| 930 | - } | |
| 931 | - @ </select> | |
| 972 | + skin_emit_skin_selector("initskin", "current", 0); | |
| 932 | 973 | @ <input type='submit' name='init3' value='Go'> |
| 933 | 974 | @ </p> |
| 934 | 975 | @ </form> |
| 935 | 976 | } |
| 936 | 977 | @ |
| 937 | 978 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -619,10 +619,69 @@ | |
| 619 | |
| 620 | @ </table> |
| 621 | style_footer(); |
| 622 | db_end_transaction(0); |
| 623 | } |
| 624 | |
| 625 | /* |
| 626 | ** WEBPAGE: setup_skinedit |
| 627 | ** |
| 628 | ** Edit aspects of a skin determined by the w= query parameter. |
| @@ -640,18 +699,19 @@ | |
| 640 | /* 0 */ { "css", "CSS", "CSS", }, |
| 641 | /* 1 */ { "footer", "Page Footer", "Footer", }, |
| 642 | /* 2 */ { "header", "Page Header", "Header", }, |
| 643 | /* 3 */ { "details", "Display Details", "Details", }, |
| 644 | }; |
| 645 | const char *zBasis; |
| 646 | const char *zContent; |
| 647 | char *zDflt; |
| 648 | char *zKey; |
| 649 | char *zTitle; |
| 650 | int iSkin; |
| 651 | int ii; |
| 652 | int j; |
| 653 | |
| 654 | login_check_credentials(); |
| 655 | |
| 656 | /* Figure out which skin we are editing */ |
| 657 | iSkin = atoi(PD("sk","1")); |
| @@ -672,15 +732,16 @@ | |
| 672 | } |
| 673 | |
| 674 | /* figure out which file is to be edited */ |
| 675 | ii = atoi(PD("w","0")); |
| 676 | if( ii<0 || ii>count(aSkinAttr) ) ii = 0; |
| 677 | zKey = mprintf("draft%d-%s", iSkin, aSkinAttr[ii].zFile); |
| 678 | zTitle = mprintf("%s for Draft%d", aSkinAttr[ii].zTitle, iSkin); |
| 679 | |
| 680 | zBasis = PD("basis","default"); |
| 681 | zDflt = mprintf("skins/%s/%s.txt", zBasis, aSkinAttr[ii].zFile); |
| 682 | db_begin_transaction(); |
| 683 | style_header("%s", zTitle); |
| 684 | for(j=0; j<count(aSkinAttr); j++){ |
| 685 | if( j==ii ) continue; |
| 686 | style_submenu_element(aSkinAttr[j].zSubmenu, |
| @@ -689,31 +750,30 @@ | |
| 689 | @ <form action="%s(g.zTop)/setup_skinedit" method="post"><div> |
| 690 | login_insert_csrf_secret(); |
| 691 | @ <input type='hidden' name='w' value='%d(ii)'> |
| 692 | @ <input type='hidden' name='sk' value='%d(iSkin)'> |
| 693 | @ <h2>Edit %s(zTitle):</h2> |
| 694 | zContent = textarea_attribute("", 10, 80, zKey, |
| 695 | aSkinAttr[ii].zFile, builtin_text(zDflt), 0); |
| 696 | @ <br /> |
| 697 | @ <input type="submit" name="submit" value="Apply Changes" /> |
| 698 | @ <hr /> |
| 699 | @ Baseline: <select size='1' name='basis'> |
| 700 | for(j=0; j<count(aBuiltinSkin); j++){ |
| 701 | cgi_printf("<option value='%h'%s>%h</option>\n", |
| 702 | aBuiltinSkin[j].zLabel, |
| 703 | fossil_strcmp(zBasis,aBuiltinSkin[j].zLabel)==0 ? " selected" : "", |
| 704 | aBuiltinSkin[j].zDesc |
| 705 | ); |
| 706 | } |
| 707 | @ </select> |
| 708 | @ <input type="submit" name="diff" value="Diff" /> |
| 709 | if( P("diff")!=0 ){ |
| 710 | u64 diffFlags = construct_diff_flags(0,0) | |
| 711 | DIFF_STRIP_EOLCR; |
| 712 | Blob from, to, out; |
| 713 | blob_init(&to, zContent, -1); |
| 714 | blob_init(&from, builtin_text(zDflt), -1); |
| 715 | blob_zero(&out); |
| 716 | if( diffFlags & DIFF_SIDEBYSIDE ){ |
| 717 | text_diff(&from, &to, &out, 0, diffFlags | DIFF_HTML | DIFF_NOTTOOBIG); |
| 718 | @ %s(blob_str(&out)) |
| 719 | }else{ |
| @@ -737,26 +797,13 @@ | |
| 737 | ** skin named by zTemplate. |
| 738 | */ |
| 739 | static void skin_initialize_draft(int iSkin, const char *zTemplate){ |
| 740 | int i; |
| 741 | if( zTemplate==0 ) return; |
| 742 | if( strcmp(zTemplate, "current")==0 ){ |
| 743 | for(i=0; i<count(azSkinFile); i++){ |
| 744 | db_set_mprintf("draft%d-%s", db_get(azSkinFile[i],""), 0, |
| 745 | iSkin, azSkinFile[i]); |
| 746 | } |
| 747 | return; |
| 748 | } |
| 749 | for(i=0; i<count(aBuiltinSkin); i++){ |
| 750 | if( strcmp(zTemplate, aBuiltinSkin[i].zLabel)==0 ){ |
| 751 | for(i=0; i<count(azSkinFile); i++){ |
| 752 | char *zKey = mprintf("skins/%s/%s.txt", zTemplate, azSkinFile[i]); |
| 753 | db_set_mprintf("draft%d-%s", builtin_text(zKey), 0, |
| 754 | iSkin, azSkinFile[i]); |
| 755 | } |
| 756 | return; |
| 757 | } |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | /* |
| 762 | ** Publish the draft skin iSkin as the new default. |
| @@ -920,17 +967,11 @@ | |
| 920 | @ |
| 921 | @ <form method='POST' action='%R/setup_skin#step4' id='f03'> |
| 922 | @ <p class='skinInput'> |
| 923 | @ <input type='hidden' name='sk' value='%d(iSkin)'> |
| 924 | @ Initialize skin <b>draft%d(iSkin)</b> using |
| 925 | @ <select size='1' name='initskin'> |
| 926 | @ <option value='current'>Currently In Use</option> |
| 927 | for(i=0; i<count(aBuiltinSkin); i++){ |
| 928 | @ <option value='%s(aBuiltinSkin[i].zLabel)'>\ |
| 929 | @ %h(aBuiltinSkin[i].zDesc) (built-in)</option> |
| 930 | } |
| 931 | @ </select> |
| 932 | @ <input type='submit' name='init3' value='Go'> |
| 933 | @ </p> |
| 934 | @ </form> |
| 935 | } |
| 936 | @ |
| 937 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -619,10 +619,69 @@ | |
| 619 | |
| 620 | @ </table> |
| 621 | style_footer(); |
| 622 | db_end_transaction(0); |
| 623 | } |
| 624 | |
| 625 | /* |
| 626 | ** Generate HTML for a <select> that lists all the available skin names, |
| 627 | ** except for zExcept if zExcept!=NULL. |
| 628 | */ |
| 629 | static void skin_emit_skin_selector( |
| 630 | const char *zVarName, /* Variable name for the <select> */ |
| 631 | const char *zDefault, /* The default value, if not NULL */ |
| 632 | const char *zExcept /* Omit this skin if not NULL */ |
| 633 | ){ |
| 634 | int i; |
| 635 | @ <select size='1' name='%s(zVarName)'> |
| 636 | if( fossil_strcmp(zExcept, "current")!=0 ){ |
| 637 | @ <option value='current'>Currently In Use</option> |
| 638 | } |
| 639 | for(i=0; i<count(aBuiltinSkin); i++){ |
| 640 | const char *zName = aBuiltinSkin[i].zLabel; |
| 641 | if( fossil_strcmp(zName, zExcept)==0 ) continue; |
| 642 | if( fossil_strcmp(zDefault, zName)==0 ){ |
| 643 | @ <option value='%s(zName)' selected>\ |
| 644 | @ %h(aBuiltinSkin[i].zDesc) (built-in)</option> |
| 645 | }else{ |
| 646 | @ <option value='%s(zName)'>\ |
| 647 | @ %h(aBuiltinSkin[i].zDesc) (built-in)</option> |
| 648 | } |
| 649 | } |
| 650 | for(i=1; i<=9; i++){ |
| 651 | char zName[20]; |
| 652 | sqlite3_snprintf(sizeof(zName), zName, "draft%d", i); |
| 653 | if( fossil_strcmp(zName, zExcept)==0 ) continue; |
| 654 | if( fossil_strcmp(zDefault, zName)==0 ){ |
| 655 | @ <option value='%s(zName)' selected>%s(zName)</option> |
| 656 | }else{ |
| 657 | @ <option value='%s(zName)'>%s(zName)</option> |
| 658 | } |
| 659 | } |
| 660 | @ </select> |
| 661 | } |
| 662 | |
| 663 | /* |
| 664 | ** Return the text of one of the skin files. |
| 665 | */ |
| 666 | static const char *skin_file_content(const char *zLabel, const char *zFile){ |
| 667 | const char *zResult; |
| 668 | if( fossil_strcmp(zLabel, "current")==0 ){ |
| 669 | zResult = db_get(zFile, ""); |
| 670 | }else if( sqlite3_strglob("draft[1-9]", zLabel)==0 ){ |
| 671 | zResult = db_get_mprintf("%s-%s", "", zLabel, zFile); |
| 672 | }else{ |
| 673 | while( 1 ){ |
| 674 | char *zKey = mprintf("skins/%s/%s.txt", zLabel, zFile); |
| 675 | zResult = builtin_text(zKey); |
| 676 | fossil_free(zKey); |
| 677 | if( zResult!=0 || fossil_strcmp(zLabel,"default")==0 ) break; |
| 678 | } |
| 679 | } |
| 680 | return zResult; |
| 681 | } |
| 682 | |
| 683 | |
| 684 | /* |
| 685 | ** WEBPAGE: setup_skinedit |
| 686 | ** |
| 687 | ** Edit aspects of a skin determined by the w= query parameter. |
| @@ -640,18 +699,19 @@ | |
| 699 | /* 0 */ { "css", "CSS", "CSS", }, |
| 700 | /* 1 */ { "footer", "Page Footer", "Footer", }, |
| 701 | /* 2 */ { "header", "Page Header", "Header", }, |
| 702 | /* 3 */ { "details", "Display Details", "Details", }, |
| 703 | }; |
| 704 | const char *zBasis; /* The baseline file */ |
| 705 | const char *zContent; /* Content after editing */ |
| 706 | char *zDraft; /* Which draft: "draft%d" */ |
| 707 | char *zKey; /* CONFIG table key name: "draft%d-%s" */ |
| 708 | char *zTitle; /* Title of this page */ |
| 709 | const char *zFile; /* One of "css", "footer", "header", "details" */ |
| 710 | int iSkin; /* draft number. 1..9 */ |
| 711 | int ii; /* Index in aSkinAttr[] of this file */ |
| 712 | int j; /* Loop counter */ |
| 713 | |
| 714 | login_check_credentials(); |
| 715 | |
| 716 | /* Figure out which skin we are editing */ |
| 717 | iSkin = atoi(PD("sk","1")); |
| @@ -672,15 +732,16 @@ | |
| 732 | } |
| 733 | |
| 734 | /* figure out which file is to be edited */ |
| 735 | ii = atoi(PD("w","0")); |
| 736 | if( ii<0 || ii>count(aSkinAttr) ) ii = 0; |
| 737 | zFile = aSkinAttr[ii].zFile; |
| 738 | zDraft = mprintf("draft%d", iSkin); |
| 739 | zKey = mprintf("draft%d-%s", iSkin, zFile); |
| 740 | zTitle = mprintf("%s for Draft%d", aSkinAttr[ii].zTitle, iSkin); |
| 741 | zBasis = PD("basis","current"); |
| 742 | |
| 743 | db_begin_transaction(); |
| 744 | style_header("%s", zTitle); |
| 745 | for(j=0; j<count(aSkinAttr); j++){ |
| 746 | if( j==ii ) continue; |
| 747 | style_submenu_element(aSkinAttr[j].zSubmenu, |
| @@ -689,31 +750,30 @@ | |
| 750 | @ <form action="%s(g.zTop)/setup_skinedit" method="post"><div> |
| 751 | login_insert_csrf_secret(); |
| 752 | @ <input type='hidden' name='w' value='%d(ii)'> |
| 753 | @ <input type='hidden' name='sk' value='%d(iSkin)'> |
| 754 | @ <h2>Edit %s(zTitle):</h2> |
| 755 | zContent = textarea_attribute( |
| 756 | "", /* Text label */ |
| 757 | 10, 80, /* Height and width of the edit area */ |
| 758 | zKey, /* Name of CONFIG table entry */ |
| 759 | zFile, /* CGI query parameter name */ |
| 760 | skin_file_content(zBasis, zFile), /* Default value of the text */ |
| 761 | 0 /* Disabled flag */ |
| 762 | ); |
| 763 | @ <br /> |
| 764 | @ <input type="submit" name="submit" value="Apply Changes" /> |
| 765 | @ <hr /> |
| 766 | @ Baseline: \ |
| 767 | skin_emit_skin_selector("basis", zBasis, zDraft); |
| 768 | @ <input type="submit" name="diff" value="Diff" /> |
| 769 | if( P("diff")!=0 ){ |
| 770 | u64 diffFlags = construct_diff_flags(0,0) | |
| 771 | DIFF_STRIP_EOLCR; |
| 772 | Blob from, to, out; |
| 773 | blob_init(&to, zContent, -1); |
| 774 | blob_init(&from, skin_file_content(zBasis, zFile), -1); |
| 775 | blob_zero(&out); |
| 776 | if( diffFlags & DIFF_SIDEBYSIDE ){ |
| 777 | text_diff(&from, &to, &out, 0, diffFlags | DIFF_HTML | DIFF_NOTTOOBIG); |
| 778 | @ %s(blob_str(&out)) |
| 779 | }else{ |
| @@ -737,26 +797,13 @@ | |
| 797 | ** skin named by zTemplate. |
| 798 | */ |
| 799 | static void skin_initialize_draft(int iSkin, const char *zTemplate){ |
| 800 | int i; |
| 801 | if( zTemplate==0 ) return; |
| 802 | for(i=0; i<count(azSkinFile); i++){ |
| 803 | const char *z = skin_file_content(zTemplate, azSkinFile[i]); |
| 804 | db_set_mprintf("draft%d-%s", z, 0, iSkin, azSkinFile[i]); |
| 805 | } |
| 806 | } |
| 807 | |
| 808 | /* |
| 809 | ** Publish the draft skin iSkin as the new default. |
| @@ -920,17 +967,11 @@ | |
| 967 | @ |
| 968 | @ <form method='POST' action='%R/setup_skin#step4' id='f03'> |
| 969 | @ <p class='skinInput'> |
| 970 | @ <input type='hidden' name='sk' value='%d(iSkin)'> |
| 971 | @ Initialize skin <b>draft%d(iSkin)</b> using |
| 972 | skin_emit_skin_selector("initskin", "current", 0); |
| 973 | @ <input type='submit' name='init3' value='Go'> |
| 974 | @ </p> |
| 975 | @ </form> |
| 976 | } |
| 977 | @ |
| 978 |