Fixed web publication editing data parsing

pull/59/head
parent 38bebc18e2
commit 35b76db466

@ -395,6 +395,10 @@ void yon_interface_update(main_window *widgets){
} }
int repos_size; int repos_size;
config_str repos = yon_char_parse(key,&repos_size,","); config_str repos = yon_char_parse(key,&repos_size,",");
char *repos_paths = yon_char_parsed_to_string(repos,repos_size,",");
char *full_path = yon_char_unite(path,!yon_char_is_empty(repos_paths)?":":"",!yon_char_is_empty(repos_paths)?repos_paths:"",NULL);
if (!yon_char_is_empty(repos_paths)) free(repos_paths);
if (!repos_size){ if (!repos_size){
int temp_size; int temp_size;
config_str contents = yon_dir_get_contents(path,&temp_size); config_str contents = yon_dir_get_contents(path,&temp_size);
@ -409,7 +413,10 @@ void yon_interface_update(main_window *widgets){
} }
gtk_list_store_set(widgets->WebPublicationList,&iter,1,path,2,yon_char_parsed_to_string(repos,repos_size,"\n"),-1); repos_paths = yon_char_parsed_to_string(repos,repos_size,"\n");
gtk_list_store_set(widgets->WebPublicationList,&iter,1,path,2,repos_paths,8,full_path,-1);
free(repos_paths);
free(full_path);
int cur_size; int cur_size;
config_str parsed = yon_char_parse(cur,&cur_size,":"); config_str parsed = yon_char_parse(cur,&cur_size,":");
if (cur_size){ if (cur_size){
@ -875,14 +882,13 @@ void on_web_publish_edit(GtkWidget *,main_window *widgets){
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->WebPublicationTree)),NULL,&iter)){ if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->WebPublicationTree)),NULL,&iter)){
char *storage; char *storage;
char *repos; char *repos;
gtk_tree_model_get(GTK_TREE_MODEL(widgets->WebPublicationList),&iter,1,&storage,2,&repos,-1); char *full;
gtk_tree_model_get(GTK_TREE_MODEL(widgets->WebPublicationList),&iter,1,&storage,2,&repos,8,&full,-1);
gtk_entry_set_text(GTK_ENTRY(window->PathEntry),storage); gtk_entry_set_text(GTK_ENTRY(window->PathEntry),storage);
while(gtk_events_pending()) gtk_main_iteration(); while(gtk_events_pending()) gtk_main_iteration();
char *full_name = storage;
if(!yon_char_is_empty(repos)){ if(!yon_char_is_empty(repos)){
int size; int size;
config_str parsed = yon_char_parse(repos,&size,"\n"); config_str parsed = yon_char_parse(repos,&size,"\n");
full_name = yon_char_unite(storage,":",yon_char_replace(repos,"\n",","),NULL);
if (size){ if (size){
GtkTreeIter itar; GtkTreeIter itar;
for_iter(GTK_TREE_MODEL(window->list),&itar){ for_iter(GTK_TREE_MODEL(window->list),&itar){
@ -894,8 +900,8 @@ void on_web_publish_edit(GtkWidget *,main_window *widgets){
} }
} }
} }
window->name = full_name; window->name = full;
char *parameter = config(REPOPUBLIC_WEB_full(full_name)); char *parameter = config(REPOPUBLIC_WEB_full(full));
int size; int size;
config_str parsed = yon_char_parse(parameter,&size,":"); config_str parsed = yon_char_parse(parameter,&size,":");
if (size){ if (size){
@ -914,6 +920,7 @@ void on_web_publish_edit(GtkWidget *,main_window *widgets){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsernameCheck),1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsernameCheck),1);
} }
if (size>4&&!yon_char_is_empty(parsed[4])){ if (size>4&&!yon_char_is_empty(parsed[4])){
gtk_combo_box_set_active(GTK_COMBO_BOX(window->UserPasswordCombo),1);
if (!strcmp(parsed[4],"sha256")||!strcmp(parsed[4],"sha512")){ if (!strcmp(parsed[4],"sha256")||!strcmp(parsed[4],"sha512")){
gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->UserPasswordCombo),parsed[4]); gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->UserPasswordCombo),parsed[4]);
gtk_entry_set_text(GTK_ENTRY(window->UserPasswordEntry),parsed[5]); gtk_entry_set_text(GTK_ENTRY(window->UserPasswordEntry),parsed[5]);
@ -1040,7 +1047,7 @@ void on_repo_accept_clicked(GtkWidget *, dictionary *dict){
repo_add_window *window = yon_dictionary_get_data(dict->first->next,repo_add_window*); repo_add_window *window = yon_dictionary_get_data(dict->first->next,repo_add_window*);
if (!window->sections) { if (!window->sections) {
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),NOTHING_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(window->SourceListBox)); yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(window->SourceListBox));
return; return;
} }
@ -1149,7 +1156,7 @@ void on_web_publish_accept(GtkWidget *, dictionary *dict){
int username_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsernameCheck)); int username_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsernameCheck));
char *username = (char*)gtk_entry_get_text(GTK_ENTRY(window->UsernameEntry)); char *username = (char*)gtk_entry_get_text(GTK_ENTRY(window->UsernameEntry));
char *user_password = yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(window->UserPasswordEntry))); char *user_password = yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(window->UserPasswordEntry)));
char *encryption = user_password[5]=='|'?yon_char_divide(user_password,6):NULL; char *encryption = user_password[6]=='|'?yon_char_divide(user_password,6):NULL;
if (username_check&&yon_char_is_empty(username)){ if (username_check&&yon_char_is_empty(username)){
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(window->UsernameEntry); yon_ubl_status_highlight_incorrect(window->UsernameEntry);
@ -1185,7 +1192,13 @@ void on_web_publish_accept(GtkWidget *, dictionary *dict){
return; return;
} }
char *final_name = yon_char_is_empty(full_name)||!disabled ? name : yon_char_unite(name,":",full_name,NULL); char *final_name = yon_char_is_empty(full_name)||!disabled ? name : yon_char_unite(name,":",full_name,NULL);
char *final = yon_char_unite(enabled?"enable":"disable",":",enable_browser?"listing":"",":",port_enabled?port:"",":",username_check?username:"",":",username_check?yon_char_is_empty(encryption)? user_password:encryption:"",":",username_check?!yon_char_is_empty(encryption)?user_password:"":"",NULL); char *final = yon_char_unite(enabled?"enable":"disable",":",
enable_browser?"listing":"",":",
port_enabled?port:"",":",
username_check?username:"",":",
username_check?yon_char_is_empty(encryption)? user_password:encryption:"",":",
username_check?!yon_char_is_empty(encryption)?user_password:"":"",
NULL);
if (!yon_char_is_empty(window->name)&&strcmp(final_name,window->name)){ if (!yon_char_is_empty(window->name)&&strcmp(final_name,window->name)){
yon_config_remove_by_key(REPOPUBLIC_WEB_full(window->name)); yon_config_remove_by_key(REPOPUBLIC_WEB_full(window->name));
} }
@ -1198,7 +1211,7 @@ void on_mirror_accept(GtkWidget *,dictionary *dict){
main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); main_window *widgets = yon_dictionary_get_data(dict->first,main_window*);
mirror_add_window *window = yon_dictionary_get_data(dict->first->next,mirror_add_window*); mirror_add_window *window = yon_dictionary_get_data(dict->first->next,mirror_add_window*);
if (!window->sections) { if (!window->sections) {
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),NOTHING_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent((window->PathBox)))))); yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent((window->PathBox))))));
return; return;
} }

@ -13,7 +13,7 @@
#define ADD_WEB_LABEL _("Add repository for publication") #define ADD_WEB_LABEL _("Add repository for publication")
#define EDIT_WEB_LABEL _("Edit repository for publication") #define EDIT_WEB_LABEL _("Edit repository for publication")
#define PASSWORD_MISMATCH_LABEL _("passwords do not match") #define PASSWORD_MISMATCH_LABEL _("Passwords do not match")
#define REPO_TOOLTIP_LABEL _("file://\t\t- Directory URL prefix for repository\n\ #define REPO_TOOLTIP_LABEL _("file://\t\t- Directory URL prefix for repository\n\
ftp://\t\t- FTP URL prefix for repository\n\ ftp://\t\t- FTP URL prefix for repository\n\

@ -376,7 +376,6 @@
<property name="sensitive">False</property> <property name="sensitive">False</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">User password</property> <property name="tooltip-text" translatable="yes">User password</property>
<property name="editable">False</property>
<property name="visibility">False</property> <property name="visibility">False</property>
<property name="invisible-char">*</property> <property name="invisible-char">*</property>
<property name="placeholder-text" translatable="yes">******</property> <property name="placeholder-text" translatable="yes">******</property>

@ -83,6 +83,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<column type="gchararray"/> <column type="gchararray"/>
<!-- column-name PasswordHash --> <!-- column-name PasswordHash -->
<column type="gchararray"/> <column type="gchararray"/>
<!-- column-name FullName -->
<column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkSizeGroup"/> <object class="GtkSizeGroup"/>

Loading…
Cancel
Save