~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/browser/specialhome.js

  • Committer: dcoles
  • Date: 2008-08-07 06:51:57 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:990
Consoleservice: Fixed a slightly confusing error message. This occurs when the 
python-console service either spits out rubbish or returns nothing at all 
(usually a forceful termination).

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
            /* Print the file listing */
74
74
            ul = document.createElement("ul");
75
75
            // Stuff
76
 
            ul.appendChild(make_subject_item(subjpath,
77
 
                path_join("users", username, subjpath), PERSONALDIR,
 
76
            ul.appendChild(make_subject_item(subjpath, PERSONALDIR,
78
77
                "Your own files in this subject"));
79
 
 
80
78
            // Groups
81
 
            var groups = subject.groups;
82
 
            for (var j=0; j<subject.groups.length; j++)
83
 
            {
84
 
                var group = subject.groups[j];
85
 
                ul.appendChild(make_subject_item(subjpath,
86
 
                    path_join("groups", subject.subj_short_name + "_" +
87
 
                              subject.year + "_" + subject.semester + "_" +
88
 
                              group.name),
89
 
                    group.name,
90
 
                    "This group's files in this subject"));
91
 
            }
 
79
            /* TODO: List groups */
92
80
            
93
81
            specialhomediv.appendChild(ul);
94
82
 
105
93
        specialhomediv.appendChild(h2);
106
94
        /* Create the contents */
107
95
        ul = document.createElement("ul");
108
 
        ul.appendChild(make_subject_item("",
109
 
              path_join("users", username, "stuff"), "stuff",
 
96
        ul.appendChild(make_subject_item("", "stuff",
110
97
              "Your own files not related to a subject"));
111
98
        specialhomediv.appendChild(ul);
112
99
        /* Remove stuff from the listing */
131
118
/* Does an series of AJAX requests to find out the properties of this folder 
132
119
 * and then updates the folder view
133
120
 */
134
 
function make_subject_item(path, repopath, name, description)
 
121
function make_subject_item(path, name, description)
135
122
{
136
123
    // Create the temporary item
137
124
    var li = document.createElement("li");
170
157
                li.appendChild(span);
171
158
 
172
159
                var button = document.createElement("input");
173
 
                $(button).click(function(event)
 
160
                button.addEventListener("click", function(event)
174
161
                {
175
162
                    action_rename(path_join(path, name));
176
 
                });
 
163
                },
 
164
                false);
177
165
                button.setAttribute("type", "button");
178
166
                button.setAttribute("value", "Rename");
179
167
                span.appendChild(button);
189
177
            li.appendChild(span);
190
178
 
191
179
            var button = document.createElement("input");
192
 
            $(button).click(function(event)
 
180
            button.addEventListener("click", function(event)
193
181
            {
194
182
                li.setAttribute("class", "listing-loading");
195
183
 
196
184
                var localpath = path_join(path, name);
 
185
                // The repository doesn't know about PERSONALDIR.
 
186
                if (name == PERSONALDIR) name = '';
 
187
                var repopath = path_join('users', username, path, name);
197
188
 
198
189
                if (create_if_needed(repopath))
199
190
                {
205
196
                {
206
197
                    li.setAttribute("class", "listing-dir");
207
198
                }
208
 
            });
 
199
            },
 
200
            false);
209
201
            button.setAttribute("type", "button");
210
202
            button.setAttribute("value", "Checkout");
211
203
            span.appendChild(button);
253
245
 */
254
246
function obj_length(obj)
255
247
{
256
 
    len = 0;
 
248
    length = 0;
257
249
    for (prop in obj)
258
 
        len++;
259
 
    return len;
 
250
        length++;
 
251
    return length;
260
252
}