Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Enhance the /setup_skin page to enable renaming of custom skins. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
2431ddf61b96b5c7ff51d9660c8570af |
| User & Date: | drh 2015-01-23 22:55:30.521 |
Context
|
2015-01-23
| ||
| 23:32 | Further enhancements to Skin processing. Provide the ability to save the current Skin using a name. check-in: e5a4206341 user: drh tags: trunk | |
| 22:55 | Enhance the /setup_skin page to enable renaming of custom skins. check-in: 2431ddf61b user: drh tags: trunk | |
| 21:03 | Correct casing of 'Tcl' where needed. check-in: 967050341d user: mistachkin tags: trunk | |
Changes
Changes to src/skins.c.
| ︙ | ︙ | |||
100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
blob_appendf(&val,
"REPLACE INTO config(name,value,mtime) VALUES(%Q,%Q,now());\n",
azType[i], z
);
}
return blob_str(&val);
}
/*
** WEBPAGE: setup_skin
*/
void setup_skin(void){
const char *z;
char *zName;
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
blob_appendf(&val,
"REPLACE INTO config(name,value,mtime) VALUES(%Q,%Q,now());\n",
azType[i], z
);
}
return blob_str(&val);
}
/*
** Respond to a Rename button press. Return TRUE if a dialog was painted.
** Return FALSE to continue with the main Skins page.
*/
static int skinRename(void){
const char *zOldName;
const char *zNewName;
if( P("rename")==0 ) return 0;
zOldName = P("sn");
zNewName = P("newname");
if( zOldName==0 ) return 0;
if( zNewName==0 || zNewName[0]==0 ){
style_header("Rename A Skin");
@ <form action="%s(g.zTop)/setup_skin" method="post"><div>
@ <table border="0"><tr>
@ <tr><td align="right">Current name:<td align="left"><b>%h(zOldName)</b>
@ <tr><td align="right">New name:<td align="left">
@ <input type="text" size="35" name="newname" value="%h(zOldName)">
@ <tr><td><td>
@ <input type="hidden" name="sn" value="%h(zOldName)">
@ <input type="submit" name="rename" value="Rename">
@ <input type="submit" name="canren" value="Cancel">
@ </table>
login_insert_csrf_secret();
@ </div></form>
style_footer();
return 1;
}
db_multi_exec(
"UPDATE config SET name='skin:%q' WHERE name='skin:%q';",
zNewName, zOldName
);
return 0;
}
/*
** WEBPAGE: setup_skin
*/
void setup_skin(void){
const char *z;
char *zName;
|
| ︙ | ︙ | |||
139 140 141 142 143 144 145 |
@ </div></form>
style_footer();
return;
}
if( P("del2")!=0 && (zName = skinVarName(P("sn"), 1))!=0 ){
db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
}
| < < < < < < < | < < < | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
@ </div></form>
style_footer();
return;
}
if( P("del2")!=0 && (zName = skinVarName(P("sn"), 1))!=0 ){
db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
}
if( skinRename() ) return;
/* The user pressed one of the "Install" buttons. */
if( P("load") && (z = P("sn"))!=0 && z[0] ){
int seen = 0;
/* Check to see if the current skin is already saved. If it is, there
** is no need to create a backup */
|
| ︙ | ︙ | |||
226 227 228 229 230 231 232 233 234 235 |
" ORDER BY name"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zN = db_column_text(&q, 0);
const char *zV = db_column_text(&q, 1);
i++;
@ <tr><td>%d(i).<td>%h(zN)<td> <td>
if( fossil_strcmp(zV, zCurrent)==0 ){
@ (Currently In Use)
}else{
| > < < < > > | | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
" ORDER BY name"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zN = db_column_text(&q, 0);
const char *zV = db_column_text(&q, 1);
i++;
@ <tr><td>%d(i).<td>%h(zN)<td> <td>
@ <form action="%s(g.zTop)/setup_skin" method="post">
if( fossil_strcmp(zV, zCurrent)==0 ){
@ (Currently In Use)
}else{
@ <input type="submit" name="load" value="Install">
@ <input type="submit" name="del1" value="Delete">
}
@ <input type="submit" name="rename" value="Rename">
@ <input type="hidden" name="sn" value="%h(zN)">
@ </form></tr>
}
db_finalize(&q);
@ </table>
style_footer();
db_end_transaction(0);
}
|